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 - L1: nrm2 support #2

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

Conversation

kballeda
Copy link

@kballeda kballeda commented Nov 2, 2022

This PR contains implementation of BLAS (Level-1) API nrm2. Raised this PR as review process can run in parallel as we investigate oneMKL nrm2 failure to sort out if it's oneMKL library issue or the passing of parameters.

Current status:

  • Julia integration of oneMKL level-1 nrm2 primitive is done
  • Facing an error thrown from native oneMKL library - Investigation in progress.

Error:
terminate called after throwing an instance of 'cl::sycl::runtime_error'
what(): Native API failed. Native API returns: -50 (CL_INVALID_ARG_VALUE) -50 (CL_INVALID_ARG_VALUE)

signal (6): Aborted
in expression starting at /home/kalib/julia_work/3010_jp_1/oneAPI.jl/test/onemkl.jl:10
gsignal at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
abort at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
__verbose_terminate_handler at /workspace/srcdir/gcc-11.1.0/libstdc++-v3/libsupc++/vterminate.cc:95
__terminate at /workspace/srcdir/gcc-11.1.0/libstdc++-v3/libsupc++/eh_terminate.cc:48
terminate at /workspace/srcdir/gcc-11.1.0/libstdc++-v3/libsupc++/eh_terminate.cc:58
__cxa_throw at /workspace/srcdir/gcc-11.1.0/libstdc++-v3/libsupc++/eh_throw.cc:95
_ZNK2cl4sycl6detail6plugin13checkPiResultINS0_13runtime_errorEEEv10_pi_result at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libsycl.so.5 (unknown line)
_ZNSt17_Function_handlerIFvRN2cl4sycl6detail7ArgDescEiEZNS2_L24SetKernelParamsAndLaunchERKSt10shared_ptrINS2_10queue_implEERSt6vectorIS3_SaIS3_EERKS6_INS2_17device_image_implEEP10_pi_kernelRNS2_8NDRDescTERSB_IP9_pi_eventSaISO_EEPSO_RKSB_IbSaIbEERKSt8functionIFPvPNS2_16AccessorImplHostEEEE3$_7E9_M_invokeERKSt9_Any_dataS4_Oi at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libsycl.so.5 (unknown line)
_ZN2cl4sycl6detailL23applyFuncOnFilteredArgsERKSt6vectorIbSaIbEERS2_INS1_7ArgDescESaIS7_EESt8functionIFvRS7_iEE at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libsycl.so.5 (unknown line)
_ZN2cl4sycl6detailL24SetKernelParamsAndLaunchERKSt10shared_ptrINS1_10queue_implEERSt6vectorINS1_7ArgDescESaIS8_EERKS2_INS1_17device_image_implEEP10_pi_kernelRNS1_8NDRDescTERS7_IP9_pi_eventSaISL_EEPSL_RKS7_IbSaIbEERKSt8functionIFPvPNS1_16AccessorImplHostEEE at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libsycl.so.5 (unknown line)
_ZN2cl4sycl6detail16enqueueImpKernelERKSt10shared_ptrINS1_10queue_implEERNS1_8NDRDescTERSt6vectorINS1_7ArgDescESaISA_EERKS2_INS1_18kernel_bundle_implEERKS2_INS1_11kernel_implEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKlRS9_IP9_pi_eventSaISX_EEPSX_RKSt8functionIFPvPNS1_16AccessorImplHostEEE at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libsycl.so.5 (unknown line)
_ZZN2cl4sycl7handler8finalizeEvENK3$_0clEv at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libsycl.so.5 (unknown line)
_ZN2cl4sycl7handler8finalizeEv at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libsycl.so.5 (unknown line)
_ZN2cl4sycl6detail10queue_impl15finalizeHandlerINS0_7handlerEEEvRT_RKNS1_2CG6CGTYPEERNS0_5eventE at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libsycl.so.5 (unknown line)
_ZN2cl4sycl6detail10queue_impl11submit_implERKSt8functionIFvRNS0_7handlerEEERKSt10shared_ptrIS2_ESD_SD_RKNS1_13code_locationEPKS3_IFvbbRNS0_5eventEEE at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libsycl.so.5 (unknown line)
_ZN2cl4sycl6detail10queue_impl6submitERKSt8functionIFvRNS0_7handlerEEERKSt10shared_ptrIS2_ERKNS1_13code_locationEPKS3_IFvbbRNS0_5eventEEE at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libsycl.so.5 (unknown line)
_ZN2cl4sycl5queue11submit_implESt8functionIFvRNS0_7handlerEEERKNS0_6detail13code_locationE at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libsycl.so.5 (unknown line)
_ZN6oneapi3mkl3gpu19snrm2_sycl_internalEPN2cl4sycl5queueElPKflPfRKSt6vectorINS3_5eventESaISA_EE at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libmkl_sycl.so.2 (unknown line)
_ZN6oneapi3mkl3gpu10snrm2_syclEPN2cl4sycl5queueElPKflPfRKSt6vectorINS3_5eventESaISA_EE at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libmkl_sycl.so.2 (unknown line)
_ZN6oneapi3mkl4blas5snrm2ERN2cl4sycl5queueElPKflPfRKSt6vectorINS3_5eventESaISA_EE at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libmkl_sycl.so.2 (unknown line)
_ZN6oneapi3mkl4blas12column_major4nrm2ERN2cl4sycl5queueElPKflPfRKSt6vectorINS4_5eventESaISB_EE at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/conda/lib/libmkl_sycl.so.2 (unknown line)
onemklSnrm2 at /home/kalib/.julia/scratchspaces/8f75cd03-7ff8-4ecb-9b8f-daf728133b1b/deps/lib/liboneapi_support.so (unknown line)
onemklSnrm2 at /home/kalib/julia_work/3010_jp_1/oneAPI.jl/lib/mkl/libonemkl.jl:50
unknown function (ip: 0x7f7a93fe514c)
_jl_invoke at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2549
nrm2! at /home/kalib/julia_work/3010_jp_1/oneAPI.jl/lib/mkl/wrappers.jl:29
norm at /home/kalib/julia_work/3010_jp_1/oneAPI.jl/lib/mkl/linalg.jl:52 [inlined]
norm at /home/kalib/julia_work/3010_jp_1/oneAPI.jl/lib/mkl/linalg.jl:55
unknown function (ip: 0x7f7a93fe3869)
_jl_invoke at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2549
jl_apply at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/julia.h:1839 [inlined]
do_apply at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/builtins.c:730
#compare#10 at /home/kalib/.julia/packages/GPUArrays/fqD8z/test/testsuite.jl:44
_jl_invoke at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2549
jl_apply at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/julia.h:1839 [inlined]
do_apply at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/builtins.c:730
compare at /home/kalib/.julia/packages/GPUArrays/fqD8z/test/testsuite.jl:38
_jl_invoke at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2549
jl_apply at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/julia.h:1839 [inlined]
do_apply at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/builtins.c:730
#testf#1 at /home/kalib/julia_work/3010_jp_1/oneAPI.jl/test/setup.jl:11
_jl_invoke at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2549
jl_apply at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/julia.h:1839 [inlined]
do_apply at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/builtins.c:730
testf at /home/kalib/julia_work/3010_jp_1/oneAPI.jl/test/setup.jl:11
_jl_invoke at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2549
macro expansion at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/usr/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined]
macro expansion at /home/kalib/julia_work/3010_jp_1/oneAPI.jl/test/onemkl.jl:14 [inlined]
macro expansion at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/usr/share/julia/stdlib/v1.8/Test/src/Test.jl:1433 [inlined]
macro expansion at /home/kalib/julia_work/3010_jp_1/oneAPI.jl/test/onemkl.jl:11 [inlined]
macro expansion at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/usr/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
top-level scope at /home/kalib/julia_work/3010_jp_1/oneAPI.jl/test/onemkl.jl:11
jl_toplevel_eval_flex at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/toplevel.c:897
jl_toplevel_eval_flex at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/toplevel.c:850
ijl_toplevel_eval_in at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/toplevel.c:965
eval at ./boot.jl:368 [inlined]
include_string at ./loading.jl:1428
_jl_invoke at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2549
_include at ./loading.jl:1488
include at ./Base.jl:419
jfptr_include_30690.clone_1 at /home/kalib/julia-oneAPI/julia-d0156b5601/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2549
exec_options at ./client.jl:303
_start at ./client.jl:522
jfptr__start_49117.clone_1 at /home/kalib/julia-oneAPI/julia-d0156b5601/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/gf.c:2549
jl_apply at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/julia.h:1839 [inlined]
true_main at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/jlapi.c:575
jl_repl_entrypoint at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/src/jlapi.c:719
main at /cache/build/default-amdci5-5/julialang/julia-release-1-dot-8/cli/loader_exe.c:59
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x401098)
Allocations: 11567276 (Pool: 11564707; Big: 2569); GC: 6
Aborted

@kballeda
Copy link
Author

kballeda commented Nov 3, 2022

@pengtu issue is resolved I had a discussion with Sarbojit about it today as it is common error, your suggestion of creating sycl buffer gave positive results to him. I also adopted to the same with his guidance. It resolves the issue. Please take a look at the PR.

@pengtu
Copy link
Owner

pengtu commented Nov 3, 2022

@kballeda: Looks nice and clean!

Please take a look at the following link: 7fc47b5
on an alternative way to get return value in the wrapper instead of allocating memory's in the mkl.cpp functions, which seems to be cleaner. Once we have a consensus, we will adapt a common schema for return values.

@kballeda
Copy link
Author

kballeda commented Nov 4, 2022

image

@kballeda
Copy link
Author

kballeda commented Nov 4, 2022

@pengtu Allocating as part of wrapper.jl looks much cleaner. I have updated nrm2. Please take a look.

@pengtu
Copy link
Owner

pengtu commented Nov 7, 2022

@pengtu Allocating as part of wrapper.jl looks much cleaner. I have updated nrm2. Please take a look.

@kballeda: Looks good, thank you!

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.

2 participants