[llvm] [offload] draft POC: verify event synchronization (PR #193927)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 27 06:52:08 PDT 2026
================
@@ -240,6 +241,45 @@ TEST_P(olLaunchKernelLocalMemStaticTest, Success) {
ASSERT_SUCCESS(olMemFree(Mem));
}
+// The test intends to verify the correctness of the current implementation of
+// the event synchronisation.
+TEST_P(olLaunchKernelSingleCounterSyncEventTest, Success) {
+ LaunchArgs.NumGroups.x = 1;
+ LaunchArgs.DynSharedMemory = 0;
+
+ void *ResNum;
+ ASSERT_SUCCESS(
+ olMemAlloc(Device, OL_ALLOC_TYPE_MANAGED, sizeof(uint32_t), &ResNum));
+
+ // The execution time of the provided kernel should be high enough to ensure
+ // that the read value of the final result is not correct without explicit
+ // synchronization: explicit waiting for the event following the submitted
+ // operation. LoopRange is arbitrarily set with the goal of prolonging the
+ // kernel execution through a high number of loop iterations. In each
+ // iteration, NumberToAdd is added to the final sum, which is stored in
+ // ResNum.
+ int32_t LoopRange = 1000000;
+ int32_t NumberToAdd = 2;
+
+ struct {
+ int32_t InitLoop;
+ int32_t Addend;
+ void *Out;
----------------
EuphoricThinking wrote:
Additionally, the kernel parameters have also changed.
https://github.com/llvm/llvm-project/pull/193927
More information about the llvm-commits
mailing list