Skip to content

Define allow_backprop in McXtrace TRACE sections - #401

Merged
g5t merged 1 commit into
mccode-dev:mainfrom
willend:2026-10-mcxtrace-allow-backprop-define
Oct 20, 2026
Merged

g5t merged 1 commit into
mccode-dev:mainfrom
willend:2026-10-mcxtrace-allow-backprop-define

Conversation

@willend

@willend willend commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Adds allow_backprop to the McXtrace TRACE runtime parameters, so the generated code gets #define allow_backprop (_particle->allow_backprop) (and the matching #undef), as McStas already does. Part of #118.

#247 added the allow_backprop member to the McXtrace particle struct (for McCode >= v3.6.9), but not the TRACE define. The McXtrace runtime macros (PROP_*, DISALLOW_BACKPROP, ... in mcxtrace-r.h) use the bare name, so almost every McXtrace instrument failed to compile against current McCode:

error: use of undeclared identifier 'allow_backprop'; did you mean 'mcallowbackprop'?

Classic reference: mccode/src/cogen.c.in:1705 in McCode includes allow_backprop in the McXtrace list.

Testing

  • New tests/test_trace_allow_backprop.py: passes with the fix, fails without it.
  • Full McXtrace mxtest --nsigma 5 --mpi=auto (macOS arm64, McCode main, mcxtrace-antlr as MCCOGEN):
  • Not tested: Linux, Windows, GPU.

Not in this PR (noticed while testing)

  • IR cache sidecars (*.comp.<build>.json) are not invalidated when a SHARE INHERIT parent component changes (SAXSPDB kept a stale copy of SAXSPDBFast's SHARE).

🤖 Generated with Claude Code

The McXtrace particle struct gained allow_backprop for McCode >= v3.6.9
(mccode-dev#247), but the TRACE #define/#undef lists only had it for McStas, so
the runtime PROP_*/DISALLOW_BACKPROP macros failed to compile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@g5t
g5t merged commit a141e88 into mccode-dev:main Oct 20, 2026
14 checks passed
@willend

willend commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

@g5t cool. antlr-test-path also enabled in McCode mcxtrace workflows now.

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