Skip to content

refactor(sysrap): make sflow a scoped enum#418

Open
plexoos wants to merge 1 commit into
mainfrom
refactor-flow-action-enum
Open

refactor(sysrap): make sflow a scoped enum#418
plexoos wants to merge 1 commit into
mainfrom
refactor-flow-action-enum

Conversation

@plexoos

@plexoos plexoos commented Jul 14, 2026

Copy link
Copy Markdown
Member

Replace the global flow-control enumerators with a typed sflow enum.

Propagate the scoped type through CSG traversal and QSim action APIs to prevent accidental integer mixing.

Replace the global flow-control enumerators with a typed sflow enum.\n\nPropagate the scoped type through CSG traversal and QSim action APIs to prevent accidental integer mixing.
Copilot AI review requested due to automatic review settings July 14, 2026 13:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5807799532

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread qudarap/qsim.h

QSIM_METHOD void fake_propagate( sphoton& p, const quad2* mock_prd, RNG& rng, unsigned long long idx );
QSIM_FORCEINLINE_METHOD int propagate(const int bounce, RNG& rng, sctx& ctx);
QSIM_FORCEINLINE_METHOD FlowAction propagate(const int bounce, RNG& rng, sctx& ctx);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update the OptiX simulate caller to FlowAction

This signature change removes the unscoped START/BREAK names that CSGOptiX/CSGOptiX7.cu still relies on in simulate (int command = START and if(command == BREAK)). In CUDA simulation builds that translation unit includes this header, so the deleted sflow.h no longer supplies those symbols, and sim->propagate(...) now returns a FlowAction that cannot be assigned to the existing int variable. Please update the OptiX bounce loop to use FlowAction::Start/FlowAction::Break too.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the legacy unscoped flow-control enumerators (UNDEFINED, BREAK, CONTINUE, …) into a strongly-typed scoped enum (FlowAction) and propagates that type through key traversal/propagation APIs (CSG tree traversal and qsim photon propagation) to reduce accidental integer mixing.

Changes:

  • Replaces sysrap/sflow.h (global unscoped enum + CPU-only formatter) with sysrap/FlowAction.h (enum class FlowAction + flow_action_name formatter).
  • Updates CSG traversal (csg_intersect_tree.h) and QSim APIs (qudarap/qsim.h, related tests) to return/use FlowAction instead of int.
  • Removes the old sflow test and updates build header lists accordingly.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sysrap/tests/sflowTest.cc Removes the old test tied to the unscoped sflow enum/formatter.
sysrap/sflow.h Deletes the legacy global flow-control enum and CPU formatter.
sysrap/FlowAction.h Adds the new scoped FlowAction enum plus a diagnostic name formatter.
sysrap/CMakeLists.txt Installs/exports FlowAction.h instead of sflow.h.
qudarap/tests/QSim_MockTest.cc Switches boundary-propagation control handling from int to FlowAction and uses flow_action_name.
qudarap/qsim.h Changes propagation routines to return FlowAction and updates return sites/comparisons accordingly.
CSG/csg_intersect_tree.h Replaces unscoped action values with FlowAction in traversal control flow.
CSG/csg_classify.h Removes stale commented-out references to the old shared action enum.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sysrap/FlowAction.h
Comment on lines +1 to +3
#pragma once
#include <string_view>

Comment thread sysrap/FlowAction.h
Comment on lines +30 to +36
/**
* Returns the stable diagnostic name of a flow-control action.
*
* @param action Flow-control action to format.
* @return Uppercase enumerator name, or "UNKNOWN" for an invalid value.
*/
constexpr std::string_view flow_action_name(FlowAction action) noexcept
Comment thread sysrap/FlowAction.h
return "LAST";
}
return "UNKNOWN";
}
@plexoos plexoos self-assigned this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants