-
Notifications
You must be signed in to change notification settings - Fork 1.6k
RISCV64-CI: don't rely on dependency resolution for qemu-user #5506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@ChipKerchner do we expect casts from bfloat16 to float32 to "just work" for C code on RISCV64 ? AFAICT this is not implemented at least in the cross-compiler setup that this gh workflow uses (even when using latest LLVM with latest riscv-gnu-toolchain), causing test failures as the intermediate |
|
Scalar casting should just work from bfloat16 to float. I don't see any issue. These are the qemu flags I use. |
|
Actually after I sync, I'm seeing a failure in sbgemm - sbgemv seems fine. BTW, I didn't write sbgemm. |
|
Thanks for the flags - unfortunately adding the missing ones did not change the outcome for me. And I'm getting |
|
Are you saying that some architectures besides RISC-V are using plain casts to float while others are using a external function? |
|
BTW, I tried an external function and I'm still getting failures. |
No, on the contrary I see RISC-V using plain casts while everything else uses an external function. |
|
Strange thing is SHGEMM uses the same type casting and all pass there. |
|
Yes, this got me thinking that maybe there is a conflict between the compiler having (or being expected to have) some "native" support for a floating point "bf16" type and OpenBLAS' fallback solution of assuming bfloat16 is an uint_16. |
|
Yes, unfortunately the BananaPi does NOT support the bf16 format. Another weird thing is the test pass for sizes 1 -> 100 but fail for size = 256. |
|
Are you sure you don't need to set this environment variable instead of LD_LIBRARY_PATH? QEMU_LD_PREFIX=/proj_sw/user_dev/ckerchner/tmp/tt-riscv-toolchain-20250709/sysroot |
|
Agree that QEMU_LD_PREFIX would be more elegant than abusing LD_LIBRARY_PATH combined with the ugly hack of crosslinking the riscv64 ld-linux into the host system path. But unfortunately this has no bearing on the main issue that this toolchain (or the most recent stable qemu) appears to produce completely bogus intermediate results (in the 2e5 to 2e6 range) from |
|
Actually I don't have actual HW for BF16 - it's all QEMU. Maybe the initialization values should be between [-0.5, +0.5] for the test rather than [+0.5,+1.5] |
|
Curious - that would leave the toolchain difference if you're also using a regular release version of qemu. |
|
Maybe additional extensions are required. https://github.com/riscv/riscv-bfloat16/blob/main/doc/riscv-bfloat16-zvfbfwma.adoc |
|
Hmm, I had always assumed these to be implied by the zvfbfwma. And indeed adding them to the compiler options does not change anything (and they were already in the qemu options). |
|
I have 2 ideas of why test_sbgemm/v is failing.
Maybe we should only test BUILD_BFLOAT16 and see if it still fails. |
|
This looks wrong in gemmkernel_2x2.c: C0 is already a float32 and TO_F32 converts BF16 -> F32. The same in gemv_n/t.c y is already a F32. P.S. FP16 seems correct for TO_F32 |
|
|
There shouldn't be a conversion from bfloat16 to __bf16. It should be picked up as a __bf16 - something like *(__bf16 *)(&B[0]) instead of a cast. Though maybe it would be easy to change the pointer types to __bf16? |
No description provided.