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

[oneMKL] Interface variants of trsm! and trmm! #479

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

amontoison
Copy link
Member

@amontoison amontoison commented Nov 4, 2024

Interface variants of trsm! and trmm! with additional arguments.

@amontoison
Copy link
Member Author

amontoison commented Nov 4, 2024

@kballeda It seems that the new variants of trsm and trmm provided by a recent release of oneMKL are not working as expected. Specifically, the ones that take beta and C as inputs. I have a reproducer for you:

T = Float32
alpha = rand(T)
beta = rand(T)

@testset "trmm!" begin
    A = triu(rand(T, m, m))
    B = rand(T, m, n)
    dA = oneArray(A)
    dB = oneArray(B)
    
    # Test without beta
    C = alpha * A * B
    oneMKL.trmm!('L', 'U', 'N', 'N', alpha, dA, dB)
    # Move to host and compare
    h_C = Array(dB)
    @test C  h_C

    # Test with beta
    C = rand(T, m, n)
    dC = oneArray(C)
    oneMKL.trmm!('L', 'U', 'N', 'N', alpha, beta, dA, dB, dC)    # <-- fail
    h_C = Array(dC)
    D = alpha * A * B + beta * C
    @test D  h_C
end

@testset "left trsm!" begin
    A = triu(rand(T, m, m))
    B = rand(T, m, n)
    dA = oneArray(A)
    dB = oneArray(B)
    
    # Test without beta
    C = alpha * (A \ B)
    dC = copy(dB)
    oneMKL.trsm!('L', 'U', 'N', 'N', alpha, dA, dC)
    @test C  Array(dC)

    # Test with beta
    C = rand(T, m, n)
    dC = oneArray(C)
    oneMKL.trsm!('L', 'U', 'N', 'N', alpha, beta, dA, dB, dC)   # <-- fail
    h_C = Array(dC)
    D = alpha * (A \ B) + beta * C
    @test D  h_C
end

@testset "right trsm!" begin
    A = rand(T, m, m)
    B = triu(rand(T, m, m))
    dA = oneArray(A)
    dB = oneArray(B)
    
    # Test without beta
    C = alpha * (A / B)
    dC = copy(dA)
    oneMKL.trsm!('R', 'U', 'N', 'N', alpha, dB, dC)
    @test C  Array(dC)

    # Test with beta
    C = rand(T, m, m)
    dC = oneArray(C)
    oneMKL.trsm!('R', 'U', 'N', 'N', alpha, beta, dA, dB, dC)  # <-- fail
    h_C = Array(dC)
    D = alpha * (A / B) + beta * C
    @test D  h_C
end

@amontoison
Copy link
Member Author

amontoison commented Nov 4, 2024

@maleadt Any update on the release 2024.2.1? (#465)
It could fix the issue.

@kballeda
Copy link
Contributor

kballeda commented Nov 5, 2024

@kballeda It seems that the new variants of trsm and trmm provided by a recent release of oneMKL are not working as expected. Specifically, the ones that take beta and C as inputs: I have a reproducer for you:

Thanks for reporting! Let me check this at my end with C reproducer.

@maleadt
Copy link
Member

maleadt commented Nov 7, 2024

Any update on the release 2024.2.1? (#465)

No, the build over at JuliaPackaging/Yggdrasil#9552 fails probably because of bugs in the Intel libraries. I was going to wait for a new version of the base toolkit before investigating. I see 2025.0.0 has been released now, so we should probably try again.

@amontoison
Copy link
Member Author

I will check how to update the wrappers for oneMKL.
Some internal routines also need an update, but that's probably something for you:

[1/4] Building CXX object CMakeFiles/oneapi_support.dir/src/sycl.cpp.o
FAILED: CMakeFiles/oneapi_support.dir/src/sycl.cpp.o 
/home/alexis/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/bin/icpx -Doneapi_support_EXPORTS  -fsycl -isystem /home/alexis/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/include -isystem /home/alexis/.julia/artifacts/4acaedf5204fc60d0f11bb5d32020fa91c5b3d10/include -std=gnu++17 -fPIC -MD -MT CMakeFiles/oneapi_support.dir/src/sycl.cpp.o -MF CMakeFiles/oneapi_support.dir/src/sycl.cpp.o.d -o CMakeFiles/oneapi_support.dir/src/sycl.cpp.o -c /home/alexis/Bureau/git/oneAPI.jl/deps/src/sycl.cpp
/home/alexis/Bureau/git/oneAPI.jl/deps/src/sycl.cpp:9:72: error: unknown type name 'pi_native_handle'; did you mean 'ur_native_handle_t'?
    9 |     auto sycl_platform = sycl::ext::oneapi::level_zero::make_platform((pi_native_handle) driver);
      |                                                                        ^~~~~~~~~~~~~~~~
      |                                                                        ur_native_handle_t
/home/alexis/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/bin/compiler/../../include/sycl/ur_api.h:400:19: note: 'ur_native_handle_t' declared here
  400 | typedef uintptr_t ur_native_handle_t;
      |                   ^
/home/alexis/Bureau/git/oneAPI.jl/deps/src/sycl.cpp:9:57: error: no member named 'make_platform' in namespace 'sycl::ext::oneapi::level_zero'
    9 |     auto sycl_platform = sycl::ext::oneapi::level_zero::make_platform((pi_native_handle) driver);
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/home/alexis/Bureau/git/oneAPI.jl/deps/src/sycl.cpp:22:68: error: unknown type name 'pi_native_handle'; did you mean 'ur_native_handle_t'?
   22 |         sycl::ext::oneapi::level_zero::make_device(platform->val, (pi_native_handle) device);
      |                                                                    ^~~~~~~~~~~~~~~~
      |                                                                    ur_native_handle_t
/home/alexis/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/bin/compiler/../../include/sycl/ur_api.h:400:19: note: 'ur_native_handle_t' declared here
  400 | typedef uintptr_t ur_native_handle_t;
      |                   ^
/home/alexis/Bureau/git/oneAPI.jl/deps/src/sycl.cpp:22:9: error: no member named 'make_device' in namespace 'sycl::ext::oneapi::level_zero'; did you mean 'sycl::ext::oneapi::level_zero::detail::make_device'?
   22 |         sycl::ext::oneapi::level_zero::make_device(platform->val, (pi_native_handle) device);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         sycl::ext::oneapi::level_zero::detail::make_device
/home/alexis/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/include/sycl/ext/oneapi/backend/level_zero.hpp:44:22: note: 'sycl::ext::oneapi::level_zero::detail::make_device' declared here
   44 | __SYCL_EXPORT device make_device(const platform &Platform,
      |                      ^
/home/alexis/Bureau/git/oneAPI.jl/deps/src/sycl.cpp:40:68: error: unknown type name 'pi_native_handle'; did you mean 'ur_native_handle_t'?
   40 |         sycl::ext::oneapi::level_zero::make_context(sycl_devices, (pi_native_handle) context, keep_ownership);
      |                                                                    ^~~~~~~~~~~~~~~~
      |                                                                    ur_native_handle_t
/home/alexis/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/bin/compiler/../../include/sycl/ur_api.h:400:19: note: 'ur_native_handle_t' declared here
  400 | typedef uintptr_t ur_native_handle_t;
      |                   ^
/home/alexis/Bureau/git/oneAPI.jl/deps/src/sycl.cpp:40:40: error: no member named 'make_context' in namespace 'sycl::ext::oneapi::level_zero'
   40 |         sycl::ext::oneapi::level_zero::make_context(sycl_devices, (pi_native_handle) context, keep_ownership);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/home/alexis/Bureau/git/oneAPI.jl/deps/src/sycl.cpp:54:93: error: unknown type name 'pi_native_handle'; did you mean 'ur_native_handle_t'?
   54 |     auto sycl_queue = sycl::ext::oneapi::level_zero::make_queue(context->val, device->val, (pi_native_handle) queue, false, keep_ownership, {});
      |                                                                                             ^~~~~~~~~~~~~~~~
      |                                                                                             ur_native_handle_t
/home/alexis/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/bin/compiler/../../include/sycl/ur_api.h:400:19: note: 'ur_native_handle_t' declared here
  400 | typedef uintptr_t ur_native_handle_t;
      |                   ^
/home/alexis/Bureau/git/oneAPI.jl/deps/src/sycl.cpp:54:54: error: no member named 'make_queue' in namespace 'sycl::ext::oneapi::level_zero'
   54 |     auto sycl_queue = sycl::ext::oneapi::level_zero::make_queue(context->val, device->val, (pi_native_handle) queue, false, keep_ownership, {});
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/home/alexis/Bureau/git/oneAPI.jl/deps/src/sycl.cpp:66:79: error: unknown type name 'pi_native_handle'; did you mean 'ur_native_handle_t'?
   66 |    auto sycl_event = sycl::ext::oneapi::level_zero::make_event(context->val, (pi_native_handle) event, keep_ownership);
      |                                                                               ^~~~~~~~~~~~~~~~
      |                                                                               ur_native_handle_t
/home/alexis/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/bin/compiler/../../include/sycl/ur_api.h:400:19: note: 'ur_native_handle_t' declared here
  400 | typedef uintptr_t ur_native_handle_t;
      |                   ^
/home/alexis/Bureau/git/oneAPI.jl/deps/src/sycl.cpp:66:53: error: no member named 'make_event' in namespace 'sycl::ext::oneapi::level_zero'
   66 |    auto sycl_event = sycl::ext::oneapi::level_zero::make_event(context->val, (pi_native_handle) event, keep_ownership);
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
10 errors generated.
[2/4] Building CXX object CMakeFiles/oneapi_support.dir/src/onemkl.cpp.o
ninja: build stopped: subcommand failed.
ERROR: LoadError: failed process: Process(`/home/alexis/.julia/artifacts/7e62c00e1f15f21da3a56196bac84e23e6d629c3/bin/ninja -C /tmp/jl_NRO6kE install`, ProcessExited(1)) [1]

@maleadt
Copy link
Member

maleadt commented Nov 11, 2024

Doesn't seem fixed on v2025.0.0

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