You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a follow-up to the completion of #113 tested a little with
McXtrace 3.5.23 and mccode-antlr 0.10.0:
mxrun --cogen=mcxtrace-antlr ESRF_BM29.instr
INFO: No output directory specified (--dir)
INFO: Using directory: "ESRF_BM29_20250213_074816"
INFO: Regenerating c-file: ESRF_BM29.c
2025-02-13 07:48:17.354 | DEBUG | mccode_antlr.translators.c:sort_include_hierarchy:41 - sort includes :Source_flat(0):read_table-lib
2025-02-13 07:48:17.354 | DEBUG | mccode_antlr.translators.c:sort_include_hierarchy:66 - sorted to read_table-lib
No initialization present?
-----------------------------------------------------------
Generating single GPU kernel or single CPU section layout:
-----------------------------------------------------------
Generating GPU/CPU -DFUNNEL layout:
-> GPU kernel from component Origin
-> GPU kernel from component Source
-> GPU kernel from component FirstPinhole
-> GPU kernel from component SecondPinhole
-> GPU kernel from component Sample
-> GPU kernel from component Beamstop
-> GPU kernel from component QMonitor
-----------------------------------------------------------
INFO: Recompiling: ./ESRF_BM29.out
./ESRF_BM29.c:10096:7: error: call to undeclared function 'RESTORE_XRAY'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
10096 | RESTORE_XRAY(INDEX_CURRENT_COMP, x, y, z, kx, ky, kz, phi, t, Ex, Ey, Ez, p);
| ^
./ESRF_BM29.c:10221:7: error: call to undeclared function 'RESTORE_XRAY'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
10221 | RESTORE_XRAY(INDEX_CURRENT_COMP, x, y, z, kx, ky, kz, phi, t, Ex, Ey, Ez, p);
| ^
2 errors generated.
Error occurs since the current mcxtrace-antlr uses RESTORE_NEUTRON.
Tiny PR incoming that renders McXtrace code-generation functional, so far only tested on this ESRF instr. :-)
@g5t if you squeeze out an 0.10.1 including #119 we could claim that mccode-antlr has
feature-complete support for McStas instruments via mcstas-antlr
basic support for McXtrace instruments via mcxtrace-antlr
(I am think that would go together well with an announced set of McCode 3.5.24s where I would announce this plus also the availability of NCrystal on Windows. Will 'hit the button for 3.5.24 today and announce it tomorrow :-) )
@g5t if you squeeze out an 0.10.1 including #119 we could claim that mccode-antlr has
* feature-complete support for McStas instruments via `mcstas-antlr`
* basic support for McXtrace instruments via `mcxtrace-antlr`
(I am think that would go together well with an announced set of McCode 3.5.24s where I would announce this plus also the availability of NCrystal on Windows. Will 'hit the button for 3.5.24 today and announce it tomorrow :-) )
Why not? As per it's now available on PyPI. I think the feedstock for Conda-Forge should pickup the new version automatically after not too long too.
This change broke compilation of mcxtrace instruments produced by mcxtrace-antlr which use mxtrace-r from McCode v3.6.9 or later.
Tests that could have identified this problem failed to do so because they have been run against a pinned version of McCode, namely v3.5.31.
Also previously absent from mccode-antlr were C-style type casts, which are now modeled. These appear to have only been used in McXtrace instruments, so the fix may unlock more compatibility between mcxtrace-antlr and mcxtrace.
Both the % comments and C-style type casts are added in #357 and will form part of the v0.30.0 release
Status check: mccode-antlr main (0.35.1, 3bed330) against McCode main, full McXtrace mxtest --nsigma 5 --mpi=auto on macOS arm64. MCCOGEN was set to mcxtrace-antlr -I$CONDA_PREFIX/share/mcxtrace/resources, as in the McStas CI workflows.
Every flagged value (MAXII_811, SOLEIL_ANATOMIX, Test_undulator, the -20 sigma Test_Mirrors subtests) and the MAXIV_DanMAX_pxrd* display timeouts are numerically identical with classic mcxtrace, so none of them is antlr-related.
Separate antlr issue found on the way: IR cache sidecars (*.comp.<build>.json) are not invalidated when a SHARE INHERIT parent changes. SAXSPDB kept a stale copy of SAXSPDBFast's SHARE until the sidecar was deleted.
* Separate antlr issue found on the way: IR cache sidecars (`*.comp.<build>.json`) are not invalidated when a `SHARE INHERIT` parent changes. `SAXSPDB` kept a stale copy of `SAXSPDBFast`'s SHARE until the sidecar was deleted.
FYI, this comment convinced me to follow-through on something I'd been considering for some time: turning off the on-disk component cache by default #402 (which also fixes the SHARE INHERIT bug you identified).
If I've understood correctly, you're asking about the possibility to modify some file (any file, really) that's in one of the mccode-pooch-registries*-registry.txt files, then ensure CI uses the local checkout rather than the tagged version from the repository?
If that's right, then you want the commands added in #311 and #315 (part of v0.28.0),
cache register to make your own registry text files
and cache populate --registry-dir to use them;
so the file cache gets whatever is in the local repository checkout (including mccode-r.h.in, which isn't installed and therefore isn't coverd by -I ${CONDA_PREFIX}/share/mscstas/resources).
You should be able to put something like this in CI step to make sure mccode-antlr uses whatever you checkout into a directory called src:
There's a potential pitfall if you decide to specify a --tag to either of those commands: they both need a valid tag value and use whatever the confuse configuration has if you don't specify anything. So if you specify a tag for either, you have to specify the same tag for both and it needs to be a tag that mccode-pooch-registries knows about. (It's fine to reuse a tag for this, so leaving the default should work fine)
Activity
willend commentedon Feb 13, 2025
Now running a full
mxtest: there are still more issues incoming but many McXtrace instrs now run correctly with antlr-driven cogen.willend commentedon Feb 18, 2025
@g5t if you squeeze out an
0.10.1including #119 we could claim thatmccode-antlrhasmcstas-antlrmcxtrace-antlr(I am think that would go together well with an announced set of McCode
3.5.24s where I would announce this plus also the availability of NCrystal on Windows. Will 'hit the button for3.5.24today and announce it tomorrow :-) )g5t commentedon Feb 18, 2025
Why not? As per
it's now available on PyPI. I think the feedstock for Conda-Forge should pickup the new version automatically after not too long too.
[-]Last(?) McXtrace obstacle - RESTORE_XRAY[/-][+]Undefined McXtrace obstacles[/+]g5t commentedon Mar 26, 2025
@willend I've changed the title of this issue since
RESTORE_XRAYwas fixed, but you mentionedFeel free to report those problems here or in new issues as you see fit, and when you have time.
willend commentedon Mar 27, 2025
Will start by a rerun of "full example suite" based on latest
mcxtrace-antlrand current McCodemain.willend commentedon Mar 27, 2025
https://new-nightly.mcxtrace.org/todays-datafiles/2025-03-27_output.html has run (and should run with ANTLR once/day from now on).
I am packing up a .tgz (unpacked 3Gig, sorry) with the whole folder structure for a later look at today's status...
g5t commentedon Jun 13, 2026
It was unclear to me at the time that
RESTORE_XRAY's functionality came with another code generator change, namely the addition ofallow_backpropto the x-ray particle state structure.This change broke compilation of
mcxtraceinstruments produced bymcxtrace-antlrwhich usemxtrace-rfrom McCodev3.6.9or later.Tests that could have identified this problem failed to do so because they have been run against a pinned version of McCode, namely
v3.5.31.g5t commentedon Sep 22, 2026
This long-standing issue may have had some progress made against it's nebulous title. At the very least, I found that one McXtrace example instrument file has comments delimited by
%-- yet another grammar rule which I did not know was allowed.https://github.com/mccode-dev/McCode/blob/29895c31a433b01ae0de95c9c6b654203559f06a/mcxtrace-comps/examples/Tests_optics/Test_Mono/Test_Mono.instr#L107-L108
Also previously absent from
mccode-antlrwereC-style type casts, which are now modeled. These appear to have only been used in McXtrace instruments, so the fix may unlock more compatibility betweenmcxtrace-antlrandmcxtrace.Both the
%comments andC-style type casts are added in #357 and will form part of thev0.30.0release[-]Undefined McXtrace obstacles[/-][+]Mixed McXtrace obstacles[/+]willend commentedon Oct 20, 2026
@g5t I've started a Claude-driven investigation of what is missing here and there. Issues and PR's to appear eventually in both code-bases.
willend commentedon Oct 20, 2026
Status check: mccode-antlr main (0.35.1,
3bed330) against McCode main, full McXtracemxtest --nsigma 5 --mpi=autoon macOS arm64. MCCOGEN was set tomcxtrace-antlr -I$CONDA_PREFIX/share/mcxtrace/resources, as in the McStas CI workflows.As is: 116/121 instruments fail to compile, 115 of them on
use of undeclared identifier 'allow_backprop'.mcxtrace's generated particle structure needsallow_backpropfromv3.6.9#247 added the struct member, butc_trace._runtime_parameters()never defined it for McXtrace. Fixed in Define allow_backprop in McXtrace TRACE sections #401.With Define allow_backprop in McXtrace TRACE sections #401: all instruments compile and run, except
Test_SAXSandTest_source_spectra, which are caused by McCode components:%include "read_table-lib";: the trailing;is accepted by classic but not expanded by antlrreturn (_comp);inSource_spectraINITIALIZE, which antlr generates asvoidBoth are fixed in McXtrace: component fixes for mcxtrace-antlr compatibility McCode#2851, and both instruments then compile with antlr.
Every flagged value (
MAXII_811,SOLEIL_ANATOMIX,Test_undulator, the -20 sigmaTest_Mirrorssubtests) and theMAXIV_DanMAX_pxrd*display timeouts are numerically identical with classicmcxtrace, so none of them is antlr-related.Separate antlr issue found on the way: IR cache sidecars (
*.comp.<build>.json) are not invalidated when aSHARE INHERITparent changes.SAXSPDBkept a stale copy ofSAXSPDBFast's SHARE until the sidecar was deleted.Not tested: Linux, Windows, GPU.
g5t commentedon Oct 21, 2026
FYI, this comment convinced me to follow-through on something I'd been considering for some time: turning off the on-disk component cache by default #402 (which also fixes the
SHARE INHERITbug you identified).willend commentedon Oct 21, 2026
How about local .c/.h share snippets?Sorry, let me rephrase:
Is there any handle to ensure that a local .c/.h takes precedence over what mccode-antlr finds upstream?
Or in other words - does what I have in e.g. the McCode basictest workflow make sense / should I do something different:
https://github.com/mccode-dev/McCode/blob/6d0e1a761054e2986de62b5fb20abb85a4a284fc/.github/workflows/mcstas-basictest.yml#L283
g5t commentedon Oct 21, 2026
If I've understood correctly, you're asking about the possibility to modify some file (any file, really) that's in one of the
mccode-pooch-registries*-registry.txtfiles, then ensure CI uses the local checkout rather than the tagged version from the repository?If that's right, then you want the commands added in #311 and #315 (part of
v0.28.0),cache registerto make your own registry text filescache populate --registry-dirto use them;so the file cache gets whatever is in the local repository checkout (including mccode-r.h.in, which isn't installed and therefore isn't coverd by
-I ${CONDA_PREFIX}/share/mscstas/resources).You should be able to put something like this in CI step to make sure
mccode-antlruses whatever you checkout into a directory calledsrc:There's a potential pitfall if you decide to specify a
--tagto either of those commands: they both need a valid tag value and use whatever theconfuseconfiguration has if you don't specify anything. So if you specify a tag for either, you have to specify the same tag for both and it needs to be a tag thatmccode-pooch-registriesknows about. (It's fine to reuse a tag for this, so leaving the default should work fine)CI: populate mccode-antlr cache from registries minted from the checkout