Skip to content

Add event re-enqueue integration test#29

Open
psychocoderHPC wants to merge 1 commit intopr-add-reusable-event-multi-handoff-testfrom
pr-add-event-reenqueue-integration-test
Open

Add event re-enqueue integration test#29
psychocoderHPC wants to merge 1 commit intopr-add-reusable-event-multi-handoff-testfrom
pr-add-event-reenqueue-integration-test

Conversation

@psychocoderHPC
Copy link
Copy Markdown
Owner

@psychocoderHPC psychocoderHPC commented Apr 8, 2026

Split from local commit 3394db6640b67d9c31d285a8b4b9bd510cb1331d.

Base branch: pr-add-reusable-event-multi-handoff-test.

Summary by CodeRabbit

  • Tests
    • Added comprehensive integration test for event re-enqueue operations across all supported backends.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5f052e56-c9c2-459b-9975-51095650dead

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pr-add-event-reenqueue-integration-test

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/integ/eventReEnqueue/eventReEnqueue.cpp`:
- Around line 33-37: The current early-return in the device availability check
(if(!devSelector.isAvailable()) { ... return; }) causes tests to be marked as
passed; replace the plain return with Catch2's skip macro (e.g., SKIP("No device
available for " + deviceSpec.getName()) or CATCH_SKIP(...) depending on project
configuration) so the branch in devSelector.isAvailable() records an explicit
skipped test using the message that includes deviceSpec.getName().
- Around line 40-41: The test currently creates producerQueue and consumerQueue
with device.makeQueue(queueKind::blocking), which serializes enqueues and hides
event re-enqueue bugs; update both calls to use queueKind::nonBlocking so
producerQueue and consumerQueue are non-blocking and the asynchronous race
around consumerQueue.waitFor(readyEvent) can surface stale-event failures
(change device.makeQueue(queueKind::blocking) to
device.makeQueue(queueKind::nonBlocking) for the producerQueue and consumerQueue
declarations).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 342e4cab-8771-426c-adf1-5df20f187a44

📥 Commits

Reviewing files that changed from the base of the PR and between 96a4ff0 and 3394db6.

📒 Files selected for processing (1)
  • test/integ/eventReEnqueue/eventReEnqueue.cpp

Comment on lines +33 to +37
if(!devSelector.isAvailable())
{
std::cout << "No device available for " << deviceSpec.getName() << std::endl;
return;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the project Catch2 version/macros and existing skip style.
rg -n -C2 'catch2|Catch2' CMakeLists.txt **/CMakeLists.txt 2>/dev/null || true
rg -n -C2 '\bSKIP\(|\bCATCH_SKIP\('

Repository: psychocoderHPC/alpaka3

Length of output: 1799


🌐 Web query:

Catch2 SKIP macro syntax version 3

💡 Result:

In Catch2 v3, the runtime-skip macro is:

  • Syntax: SKIP( [streamable expression] ) (the message is optional, so SKIP() is valid) [1]
  • Example:
    TEST_CASE("copy files between drives") {
        if (getNumberOfHardDrives() < 2) {
            SKIP("at least two hard drives required");
        }
        // ...
    }
    [1]

Notes:

  • SKIP was introduced in Catch2 3.3.0. [1]
  • Like an explicit FAIL, SKIP stops execution of the current test/section at that point. [1]

Sources: [1]


🌐 Web query:

Catch2 CATCH_SKIP vs SKIP macro

💡 Result:

In Catch2, SKIP(...) and CATCH_SKIP(...) are the same feature, just exposed under different naming depending on configuration:

  • SKIP(...) is the default user-facing macro (when you are not prefixing all macros). It records an explicit skip and then immediately aborts the current test case/section (similar control-flow to FAIL). [1][2]
  • CATCH_SKIP(...) is the prefixed equivalent that is only provided when you compile with CATCH_CONFIG_PREFIX_ALL (to avoid macro name collisions by prefixing everything with CATCH_). Its implementation is the same (explicit skip + abort). [1]

Notes:

  • Runtime skipping via SKIP/CATCH_SKIP was introduced in Catch2 v3.3.0. [2]

Sources:
[1] Catch2 header (catch_test_macros.hpp) showing CATCH_SKIP vs SKIP definitions (prefixed vs unprefixed). (raw.githubusercontent.com)
[2] Catch2 docs: “Explicitly skipping… at runtime” (SKIP macro, behavior, version introduced). (catch2-temp.readthedocs.io)

Citations:


Mark unavailable-device cases as skipped instead of passed.

On Line 36, return; marks "no device" as a passing test. Use Catch2's SKIP() macro (available in v3.3.0+) to report this case explicitly.

Proposed change
     if(!devSelector.isAvailable())
     {
-        std::cout << "No device available for " << deviceSpec.getName() << std::endl;
-        return;
+        SKIP(std::string("No device available for ") + deviceSpec.getName());
     }

Note: Ensure the correct macro name (SKIP or CATCH_SKIP if prefixed) matches your project's Catch2 configuration. The SKIP() macro stops test execution and records an explicit skip in CI reports.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if(!devSelector.isAvailable())
{
std::cout << "No device available for " << deviceSpec.getName() << std::endl;
return;
}
if(!devSelector.isAvailable())
{
SKIP(std::string("No device available for ") + deviceSpec.getName());
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/integ/eventReEnqueue/eventReEnqueue.cpp` around lines 33 - 37, The
current early-return in the device availability check
(if(!devSelector.isAvailable()) { ... return; }) causes tests to be marked as
passed; replace the plain return with Catch2's skip macro (e.g., SKIP("No device
available for " + deviceSpec.getName()) or CATCH_SKIP(...) depending on project
configuration) so the branch in devSelector.isAvailable() records an explicit
skipped test using the message that includes deviceSpec.getName().

Comment on lines +40 to +41
onHost::Queue producerQueue = device.makeQueue(queueKind::blocking);
onHost::Queue consumerQueue = device.makeQueue(queueKind::blocking);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify available queue kinds and existing async test patterns.
rg -n -C2 'enum class queueKind|queueKind::blocking|queueKind::nonBlocking'
rg -n -C3 'waitFor\(|enqueue\(readyEvent\)|makeQueue\(queueKind::'

Repository: psychocoderHPC/alpaka3

Length of output: 1792


🏁 Script executed:

#!/bin/bash
# Search for queue kind enum and usage patterns
find . -type f -name "*.hpp" -o -name "*.h" -o -name "*.cpp" | head -20

Repository: psychocoderHPC/alpaka3

Length of output: 914


🏁 Script executed:

#!/bin/bash
# Search for queueKind enum definition and usage
rg -n "enum.*queueKind|queueKind::" --type cpp --type hpp | head -50

Repository: psychocoderHPC/alpaka3

Length of output: 93


🏁 Script executed:

#!/bin/bash
# Search for queueKind enum definition and usage
rg -n "enum.*queueKind|queueKind::" | head -60

Repository: psychocoderHPC/alpaka3

Length of output: 6549


🏁 Script executed:

#!/bin/bash
# Read the eventReEnqueue test file to understand the test logic
cat test/integ/eventReEnqueue/eventReEnqueue.cpp

Repository: psychocoderHPC/alpaka3

Length of output: 2742


Use non-blocking queues to properly test event re-enqueue semantics.

Blocking queues serialize all enqueue operations, completing them before consumerQueue.waitFor(readyEvent) executes. This masks failures in event re-enqueue—if the event doesn't move to the later kernel completion point, the test still passes because all work is already done. Non-blocking queues create an actual asynchronous race where a stale event would cause the consumer to observe pre-kernel data.

Change lines 40–41 to use queueKind::nonBlocking:

Proposed change
-    onHost::Queue producerQueue = device.makeQueue(queueKind::blocking);
-    onHost::Queue consumerQueue = device.makeQueue(queueKind::blocking);
+    onHost::Queue producerQueue = device.makeQueue(queueKind::nonBlocking);
+    onHost::Queue consumerQueue = device.makeQueue(queueKind::nonBlocking);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
onHost::Queue producerQueue = device.makeQueue(queueKind::blocking);
onHost::Queue consumerQueue = device.makeQueue(queueKind::blocking);
onHost::Queue producerQueue = device.makeQueue(queueKind::nonBlocking);
onHost::Queue consumerQueue = device.makeQueue(queueKind::nonBlocking);
🧰 Tools
🪛 Cppcheck (2.20.0)

[error] 40-40: Found an exit path from function with non-void return type that has missing return statement

(missingReturn)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/integ/eventReEnqueue/eventReEnqueue.cpp` around lines 40 - 41, The test
currently creates producerQueue and consumerQueue with
device.makeQueue(queueKind::blocking), which serializes enqueues and hides event
re-enqueue bugs; update both calls to use queueKind::nonBlocking so
producerQueue and consumerQueue are non-blocking and the asynchronous race
around consumerQueue.waitFor(readyEvent) can surface stale-event failures
(change device.makeQueue(queueKind::blocking) to
device.makeQueue(queueKind::nonBlocking) for the producerQueue and consumerQueue
declarations).

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.

1 participant