Skip to content
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

[BLAS][generic] Fix compilation with AdaptiveCpp #655

Merged
merged 3 commits into from
Apr 4, 2025

Conversation

rafbiels
Copy link
Contributor

@rafbiels rafbiels commented Mar 24, 2025

Description

The generic BLAS backend currently offers limited support for AdaptiveCpp, where:

  • complex data type is not supported
  • USM API is not supported

Add the required protections to make the generic BLAS backend compile and run correctly in the capacity it offers with AdaptiveCpp. That is, make the buffer API with real/integer data work fine. Throw the unimplemented exception for the unsupported features.

This change relies on the update of the generic blas backend to version 0.2.0 in: uxlfoundation/generic-sycl-components#7

Checklist

  • Do all unit tests pass locally?
    • Tested on 12th gen Intel integrated GPU with SPIRV JIT compilation.
    • DPC++ before this PR: 1961 tests, 1800 skipped, 161 ran, 136 failed, 25 passed - ut-dpcpp-igpu-spirv-ref.log.gz
    • DPC++ with this PR: 1961 tests, 1800 skipped, 161 ran, 136 failed, 25 passed - ut-dpcpp-igpu-spirv.log.gz
    • AdaptiveCpp before this PR: doesn't compile
    • AdaptiveCpp with this PR: 1961 tests, 1802 skipped, 159 ran, 117 failed, 42 passed - ut-acpp-igpu.log.gz
  • Have you added relevant regression tests? No AdaptiveCpp-specific tests are needed, existing tests provide enough coverage and should work with both DPC++ and AdaptiveCpp.
  • Have you included information on how to reproduce the issue (either in a GitHub issue or in this PR)? Compiled with
    -DONEMATH_SYCL_IMPLEMENTATION=hipsycl -DENABLE_MKLCPU_BACKEND=False
    -DHIPSYCL_TARGETS='generic -DENABLE_MKLGPU_BACKEND=False
    -DENABLE_MKLCPU_BACKEND=False -DENABLE_GENERIC_BLAS_BACKEND=True
    -DBUILD_FUNCTIONAL_TESTS=True -DBUILD_EXAMPLES=True

@rafbiels rafbiels requested a review from a team as a code owner March 24, 2025 13:53
Copy link
Contributor

@Rbiessy Rbiessy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, I can see why this can be needed.
I don't get why do you say that no unit tests are available? Do you mean there is another issue with AdaptiveCpp preventing you to run the tests?

@rafbiels
Copy link
Contributor Author

rafbiels commented Mar 26, 2025

I don't get why do you say that no unit tests are available? Do you mean there is another issue with AdaptiveCpp preventing you to run the tests?

I missed I needed NETLIB to build the tests. I installed it now and ran the tests, however, with the tip of the develop branch (as reference) when compiling with DPC++ for NVIDIA GPU, I'm getting very poor results. Out of 1961 tests 1636 are skipped and 277 fail, so only 48 pass. Is this expected? I'm getting the same results with the changes in this PR and DPC++, so there is no regression. I can upload the output, but I must be doing something wrong, so should perhaps rerun in another configuration?

My commands were:

source /opt/intel/oneapi/setvars.sh
git clone https://github.com/uxlfoundation/oneMath.git
cd oneMath
cmake -Bbuild-dpcpp -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/install-dpcpp -DCMAKE_CXX_COMPILER=icpx -DCMAKE_C_COMPILER=icx -DENABLE_MKLGPU_BACKEND=False -DENABLE_MKLCPU_BACKEND=False -DBUILD_FUNCTIONAL_TESTS=True -DBUILD_EXAMPLES=True -G Ninja -DENABLE_GENERIC_BLAS_BACKEND=True -DGENERIC_BLAS_TUNING_TARGET=NVIDIA_GPU
cmake --build build-dpcpp
ctest --test-dir build-dpcpp --output-on-failure -j16

@Rbiessy
Copy link
Contributor

Rbiessy commented Mar 27, 2025

The tests being marked as skipped is expected. One CTest runs multiple configurations and if one of them is not supported the test is marked as skipped. It's not great but changing that would be a large change I think.
The failures are not expected. The internal CI is working fine. This could have something to do with the CUDA version used, the CI uses 12.2. Or maybe with running the tests with -j16? (that would be bad). In case case for the scope of this PR I can run the CI once the changes are ready.
I'd suggest you attach a test log showing the complex tests are indeed skipped when disabled and if you have any tests failing with your configuration attach another one showing this patch does make more tests fail. You could also run the tests on an integrated GPU if that's easier.

The generic BLAS backend currently offers limited support for
AdaptiveCpp, where:
* complex data type is not supported
* USM API is not supported

Add the required protections to make the generic BLAS backend
compile and run correctly in the capacity it offers with AdaptiveCpp.
That is, make the buffer USM without complex data work fine. Throw
the unimplemented exception for the unsupported features.

This change relies on the update of the generic blas backend to
version 0.2.0 in:
uxlfoundation/generic-sycl-components#7
@rafbiels rafbiels force-pushed the generic-blas-adaptivecpp branch from fb95b33 to 18081dc Compare March 31, 2025 22:29
@rafbiels rafbiels marked this pull request as ready for review April 1, 2025 10:47
@rafbiels rafbiels requested a review from a team as a code owner April 1, 2025 10:47
@rafbiels
Copy link
Contributor Author

rafbiels commented Apr 1, 2025

@Rbiessy this is ready, but please rerun CI here after uxlfoundation/generic-sycl-components#7 is merged as oneMath pulls the main branch. Before the merge, the variables are not exported so complex and USM support gets disabled in oneMath.

I uploaded new unit test outputs in the description which confirm there's no regression, but I still feel I'm doing something wrong on my system or the tests are unreliable as I'm getting very few tests passing even with Intel iGPU or CPU with the head of develop branch.

Copy link
Contributor

@Rbiessy Rbiessy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rafbiels for the work, this looks good to me! We need 2 approvals on this PR so can someone from @uxlfoundation/onemath-arch-write review this one? Then we can merge the generic-blas PR, re-run the CI here and ensure the CI passes before merging.

Copy link
Contributor

@andrewtbarker andrewtbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thansk for this fix! I have a very minor suggestion but it is not required for merging.

@rafbiels
Copy link
Contributor Author

rafbiels commented Apr 3, 2025

CI failing due to #658 - this needs fixing first

@Rbiessy Rbiessy merged commit 20ba6fd into uxlfoundation:develop Apr 4, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants