Skip to content

compiler: Misc dtype lowering tweaks - #3090

Open
FabioLuporini wants to merge 3 commits into
mainfrom
next-gen
Open

FabioLuporini wants to merge 3 commits into
mainfrom
next-gen

Conversation

@FabioLuporini

Copy link
Copy Markdown
Contributor

No description provided.

Infer vector result types from operands, initialize each component,
and reuse only type-compatible reduction accumulators. Preserve
scalar precision queries for compiler metadata and FD weights.
values = p._arg_values(estimate_memory=estimate_memory, **kwargs)
# A replacement may supply defaults for other arguments, such as
# a ConditionalDimension's factor. Explicit overrides take precedence
args.update({k: v for k, v in values.items()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is gonna get dropped

for p in overrides:
args.update(p._arg_values(estimate_memory=estimate_memory, **kwargs))
values = p._arg_values(estimate_memory=estimate_memory, **kwargs)
# A replacement may supply defaults for other arguments, such as

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.

this looks like a bug in _arg_values

if not dtypes or not np.issubdtype(base, np.complexfloating):
dtypes.update({base} - {None})

dtypes = {dtypes_vector_mapper.get_base_dtype(i, i) for i in dtypes}

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.

second place it's like that, why not move it inside infer_dtype?

return max(dtypes, key=lambda i: np.dtype(i).itemsize, default=None)
dtype = max(dtypes, key=lambda i: np.dtype(i).itemsize, default=None)

return dtypes_vector_mapper[dtype, n] if n > 1 else dtype

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.

likely need .get for safety?

Extract the result dtype, retaining typed vector operands such as float2.
"""
# Arithmetic nodes may expose only their Functions' scalar precision
if not (expr.is_Add or expr.is_Mul or expr.is_Pow):

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.

so what does it leave? THis is an off check

@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.18033% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.32%. Comparing base (edad729) to head (cd180b0).

Files with missing lines Patch % Lines
devito/tools/dtypes_lowering.py 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3090      +/-   ##
==========================================
+ Coverage   84.29%   84.32%   +0.03%     
==========================================
  Files         258      258              
  Lines       57460    57562     +102     
  Branches     4914     4920       +6     
==========================================
+ Hits        48436    48542     +106     
+ Misses       8202     8196       -6     
- Partials      822      824       +2     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 68.51% <69.44%> (+0.02%) ⬆️
pytest-gpu-gcc- 78.95% <99.18%> (+0.02%) ⬆️
pytest-gpu-icx- 78.88% <99.18%> (+0.03%) ⬆️
pytest-gpu-nvc-nvidiaX 69.21% <69.44%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

This branch has not been deployed

No deployments
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