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

Fix OpenCL Event memory leak #711

Merged
merged 9 commits into from
Dec 1, 2023
Merged

Fix OpenCL Event memory leak #711

merged 9 commits into from
Dec 1, 2023

Conversation

pvelesko
Copy link
Collaborator

  • Add a new pure virtual function for event creation, separating into shared and non-shared events
  • hip_async_binomial which uses hipGetNativeEventFromHipEvent still has events outstanding after completion as indicated by OpenCL object lifetime layer.

@pvelesko
Copy link
Collaborator Author

Observed the clang crash here as well:

[  0%] Built target KERNELS
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/install/llvm/15.0/bin/clang-15 -cc1 -triple x86_64-unknown-linux-gnu -aux-triple spirv64 -emit-obj --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name hip_test_context.cc -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -target-feature +f16c -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=/opt/actions-runner/_work/chipStar/chipStar/build/catch/catch_tests/hipTestMain -resource-dir /opt/install/llvm/15.0/lib/clang/15.0.6 -dependency-file CMakeFiles/Main_Object_Standalone.dir/hip_test_context.cc.o.d -MT catch/catch_tests/hipTestMain/CMakeFiles/Main_Object_Standalone.dir/hip_test_context.cc.o -sys-header-deps -internal-isystem /opt/install/llvm/15.0/lib/clang/15.0.6 -idirafter /opt/actions-runner/_work/chipStar/chipStar/build/include -include /opt/actions-runner/_work/chipStar/chipStar/include/hip/spirv_fixups.h -I //opt/actions-runner/_work/chipStar/chipStar/build/include -D KERNELS_PATH=/opt/actions-runner/_work/chipStar/chipStar/HIP/tests/catch/kernels/ -I /opt/actions-runner/_work/chipStar/chipStar/CHIP -I /opt/actions-runner/_work/chipStar/chipStar/PUBLIC -I /usr/local/lib/../include/level_zero -I /opt/actions-runner/_work/chipStar/chipStar/HIP/tests/catch/external/Catch2 -I /opt/actions-runner/_work/chipStar/chipStar/HIP/tests/catch/./include -I /opt/actions-runner/_work/chipStar/chipStar/HIP/tests/catch/./kernels -I /opt/actions-runner/_work/chipStar/chipStar/build/include -I /opt/actions-runner/_work/chipStar/chipStar/HIP/tests/catch/external/picojson -D NDEBUG -D __HIP_PLATFORM_SPIRV__= -I /opt/actions-runner/_work/chipStar/chipStar/include -I /opt/actions-runner/_work/chipStar/chipStar/HIP/include -I /opt/actions-runner/_work/chipStar/chipStar/build/include -I/home/pvelesko/install/intel/opencl/2023.10.02/include -I/opt/install/llvm/15.0/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward -internal-isystem /opt/install/llvm/15.0/lib/clang/15.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem /opt/install/llvm/15.0/lib/clang/15.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-duplicate-decl-specifier -Wno-tautological-constant-compare -Wno-c++20-extensions -Wno-unused-result -Wno-delete-abstract-non-virtual-dtor -Wno-deprecated-declarations -Wunused-command-line-argument -Wno-format-extra-args -std=c++17 -fdeprecated-macro -fdebug-compilation-dir=/opt/actions-runner/_work/chipStar/chipStar/build/catch/catch_tests/hipTestMain -ferror-limit 19 -fhip-new-launch-api -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -vectorize-loops -vectorize-slp -no-opaque-pointers -fcuda-include-gpubinary /tmp/hip_test_context-1ab052.hipfb -cuid=46f0c2c59e176fc7 -fcuda-allow-variadic-functions -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/Main_Object_Standalone.dir/hip_test_context.cc.o -x hip /opt/actions-runner/_work/chipStar/chipStar/HIP/tests/catch/hipTestMain/hip_test_context.cc
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '/opt/actions-runner/_work/chipStar/chipStar/HIP/tests/catch/hipTestMain/hip_test_context.cc'.
4.	Running pass 'Block Frequency Analysis' on function '@_ZNSt8__detail4_NFAINSt7__cxx1112regex_traitsIcEEE23_M_insert_subexpr_beginEv'
clang-15: error: unable to execute command: Segmentation fault (core dumped)
clang-15: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 15.0.6 ([email protected]:CHIP-SPV/llvm-project.git 31233417513505db770574f3857f090cdcea3828)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/install/llvm/15.0/bin
clang-15: note: diagnostic msg: Error generating preprocessed source(s).

failed to execute:/opt/install/llvm/15.0/bin/clang++ -include /opt/actions-runner/_work/chipStar/chipStar/include/hip/spirv_fixups.h -I//opt/actions-runner/_work/chipStar/chipStar/build/include -DKERNELS_PATH="/opt/actions-runner/_work/chipStar/chipStar/HIP/tests/catch/kernels/" -I/opt/actions-runner/_work/chipStar/chipStar/CHIP -I/opt/actions-runner/_work/chipStar/chipStar/PUBLIC -I/usr/local/lib/../include/level_zero -I/opt/actions-runner/_work/chipStar/chipStar/HIP/tests/catch/external/Catch2 -I/opt/actions-runner/_work/chipStar/chipStar/HIP/tests/catch/./include -I/opt/actions-runner/_work/chipStar/chipStar/HIP/tests/catch/./kernels -I/opt/actions-runner/_work/chipStar/chipStar/build/include -I/opt/actions-runner/_work/chipStar/chipStar/HIP/tests/catch/external/picojson -Wno-duplicate-decl-specifier -Wno-tautological-constant-compare -Wno-c++20-extensions -Wno-unused-result -Wno-delete-abstract-non-virtual-dtor -Wno-deprecated-declarations -Wunused-command-line-argument --std=c++17 -O3 -DNDEBUG -fPIC -Wno-format-extra-args -mf16c -std=c++17 -MD -c -x hip /opt/actions-runner/_work/chipStar/chipStar/HIP/tests/catch/hipTestMain/hip_test_context.cc -D__HIP_PLATFORM_SPIRV__= --offload=spirv64 -Xclang -no-opaque-pointers -nohipwrapperinc --hip-path=/opt/actions-runner/_work/chipStar/chipStar/build --target=x86_64-unknown-linux-gnu   -I/opt/actions-runner/_work/chipStar/chipStar/include -I/opt/actions-runner/_work/chipStar/chipStar/HIP/include -I/opt/actions-runner/_work/chipStar/chipStar/build/include -o CMakeFiles/Main_Object_Standalone.dir/hip_test_context.cc.o -MT catch/catch_tests/hipTestMain/CMakeFiles/Main_Object_Standalone.dir/hip_test_context.cc.o -MF CMakeFiles/Main_Object_Standalone.dir/hip_test_context.cc.o.d
make[3]: *** [catch/catch_tests/hipTestMain/CMakeFiles/Main_Object_Standalone.dir/build.make:90: catch/catch_tests/hipTestMain/CMakeFiles/Main_Object_Standalone.dir/hip_test_context.cc.o] Error 1

@pjaaskel pjaaskel added this to the 1.1 milestone Nov 30, 2023
@pjaaskel
Copy link
Collaborator

This is a major fix so can you backport to Release-1.1 as well?

@pvelesko pvelesko merged commit 48b58ee into main Dec 1, 2023
23 checks passed
@pvelesko pvelesko deleted the opencl-events-refactor branch December 1, 2023 05:43
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