Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print warning when overwriting COPY EXTEND %{%} block from instance #1786

Merged
merged 3 commits into from
Dec 4, 2024

Conversation

willend
Copy link
Contributor

@willend willend commented Dec 3, 2024

Candidate solution to #1785

The attached instrument COPY_EXTEND_1 has a COMPONENT comp2=COPY(comp1) instance with an EXTEND %{%} block, which thus overwrites the EXTEND %{%} that arrives via the COPY(comp1) clause:

mcstas COPY_EXTEND_1.instr 

-----------------------------------------------------------
WARNING (COMPONENT comp2): Existing (COPY) EXTEND block:

  EXTEND %{
    // An extend block
    dummy=_comp->index;
  %}

will be been overwritten by:

  EXTEND %{
    // An other extend block
    dummy=2*_comp->index;
  %}
-----------------------------------------------------------

-----------------------------------------------------------

Generating single GPU kernel or single CPU section layout: 

-----------------------------------------------------------

Generating GPU/CPU -DFUNNEL layout:

-----------------------------------------------------------
CFLAGS=

I further attach COPY_EXTEND_2 which has a COMPONENT comp2=COPY(comp1) with an EXTEND %{%} block, but where COPY(comp1) includes no EXTEND block:

mcstas COPY_EXTEND_2.instr 

-----------------------------------------------------------

Generating single GPU kernel or single CPU section layout: 

-----------------------------------------------------------

Generating GPU/CPU -DFUNNEL layout:

-----------------------------------------------------------
CFLAGS=

@willend willend requested review from farhi and g5t December 3, 2024 18:44
Copy link
Contributor

@g5t g5t left a comment

Choose a reason for hiding this comment

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

This change accomplishes the goal to warn users when they overwrite an inherited component instance EXTEND block set via COPY.
I think the message could be clearer, but my opinion is not necessarily correct.

mcstas/src/instrument.y Outdated Show resolved Hide resolved
@willend willend merged commit 7d9766a into main Dec 4, 2024
32 checks passed
@willend willend deleted the COPY_warn_EXTEND branch December 16, 2024 10:20
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