Skip to content

backend: (x86) report unsupported vector sizes without the raw KeyError - #6361

Merged
superlopuh merged 2 commits into
xdslproject:mainfrom
manishpaulish:fix/x86-vector-size-diagnostic
Aug 14, 2026
Merged

backend: (x86) report unsupported vector sizes without the raw KeyError#6361
superlopuh merged 2 commits into
xdslproject:mainfrom
manishpaulish:fix/x86-vector-size-diagnostic

Conversation

@manishpaulish

Copy link
Copy Markdown
Contributor

Split out of #6360 as requested, with a dedicated test.

_register_type_for_vector_type raises DiagnosticException from inside except KeyError, which chains the dict lookup onto the traceback. A vector too wide for the target therefore reports:

KeyError: 512

During handling of the above exception, another exception occurred:
...
DiagnosticException: The vector size (512 bits) and target architecture `avx2` are inconsistent.

The diagnostic underneath is correct, but KeyError: 512 is the first thing you see and it points at a dict rather than at the problem.

Two changes:

  • suppress the chain with raise ... from None
  • name the sizes the target does support, since "inconsistent" alone does not tell you whether the vector is too wide, too narrow, or an odd width
DiagnosticException: The vector size (512 bits) and target architecture `avx2`
are inconsistent. Supported vector sizes are [128, 256].

The test covers all three targets and asserts the KeyError is not chained, via __cause__ and __suppress_context__, so a future refactor that drops the from None fails rather than quietly regressing the message.

Raising DiagnosticException from inside 'except KeyError' chained the dict
lookup onto the traceback, so a vector too wide for the target printed
'KeyError: 512' above the real explanation. Suppress the chain with
'from None' and list the sizes the target does support.

Split out of xdslproject#6360 at review request, with a test covering all three
targets and asserting the KeyError is not chained.
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.93%. Comparing base (b642df9) to head (f90b17d).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6361   +/-   ##
=======================================
  Coverage   86.93%   86.93%           
=======================================
  Files         439      439           
  Lines       65902    65919   +17     
  Branches     7490     7490           
=======================================
+ Hits        57289    57304   +15     
- Misses       7036     7038    +2     
  Partials     1577     1577           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread tests/backend/x86/test_lowering_utils.py Outdated
@superlopuh superlopuh added the backend Compiler backend in xDSL label Aug 14, 2026
@superlopuh
superlopuh merged commit 129f851 into xdslproject:main Aug 14, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Compiler backend in xDSL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants