FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

compiler: fix temp/array alloc by mloubout · Pull Request #2664 · devitocodes/devito · GitHub

compiler: fix temp/array alloc - #2664

Merged
mloubout merged 3 commits into
mainfrom
index-mode
Jul 15, 2025
Merged

compiler: fix temp/array alloc#2664
mloubout merged 3 commits into
mainfrom
index-mode

Conversation

mloubout commented Jul 13, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

Fix allocation size with index-mode set to long

codecov Bot commented Jul 13, 2025
edited
Loading

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 76.31579% with 9 lines in your changes missing coverage. Please review.

Project coverage is 91.30%. Comparing base (598fd62) to head (e906679).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
devito/arch/compiler.py 25.00% 5 Missing and 1 partial ⚠️
devito/symbolics/manipulation.py 75.00% 2 Missing ⚠️
devito/passes/iet/definitions.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2664      +/-   ##
==========================================
- Coverage   91.98%   91.30%   -0.69%     
==========================================
  Files         245      245              
  Lines       48811    48831      +20     
  Branches     4307     4308       +1     
==========================================
- Hits        44901    44583     -318     
- Misses       3215     3536     +321     
- Partials      695      712      +17     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 72.53% <34.61%> (-0.01%) ⬇️
pytest-gpu-nvc-nvidiaX ?

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

☔ View full report in Codecov by Sentry.
📢 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.

mloubout force-pushed the index-mode branch 2 times, most recently from a1f8cb6 to 5c7bd87 Compare July 13, 2025 20:48
Comment thread devito/ir/cgen/printer.py Outdated
Comment thread devito/passes/iet/definitions.py Outdated
Comment thread devito/passes/iet/definitions.py Outdated
mloubout force-pushed the index-mode branch 2 times, most recently from b49a010 to 390769a Compare July 14, 2025 12:43

Copy link
Copy Markdown

Check out this pull request on 

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Comment thread devito/ir/iet/nodes.py Outdated
Comment thread devito/passes/iet/definitions.py Outdated
Comment thread devito/ir/iet/visitors.py
Comment thread devito/ir/iet/visitors.py
Comment thread devito/ir/iet/visitors.py Outdated
Comment thread devito/ir/iet/visitors.py
Comment thread devito/passes/iet/definitions.py Outdated
Comment thread tests/test_linearize.py


@pytest.mark.parametrize('order', [2, 4])
def test_int64_array(order):

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nitpick: test_array_w_int64_index perhaps? The current test name sounds like the Array contains int64 data

mloubout force-pushed the index-mode branch 3 times, most recently from 34f132b to 94b63bf Compare July 14, 2025 18:26
Comment thread devito/ir/cgen/printer.py

ULONG = cast(np.uint64)
UINTP = cast(np.uint32, '*')
LONG = cast(np.int64)

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

uber-nitpicking: makes me thing we could rather use as_ulong since it's a size which is definitely positive

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We could, but annoying to red-uodate those notebooks. I don't think long is much of an issue and unsigned long everywhere will just make it more verbose


def as_long(expr):
"""
Convert an expression and its symbolic args to a long integer.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Actually, I just checked, as long as one of the operands is cast to long, you're good to go. IOW, you don't need to cast all operands to long. Which might improve verbosity.

So technically we might get away with simply just changing these lines

SizeOf(obj._C_typedata)*obj.size

into

ULONG(SizeOf(obj._C_typedata))*obj.size

Sorry, I only thought about this now 😬

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No it doesn't, I actually tried with the JIT backdoor and the obj.size will evaluate as int first then converted to long so if it overflows then the conversion will not do anything

self.gpu_create = kwargs['options']['gpu-create']
self.pmode = kwargs['options'].get('place-transfers')
def __init__(self, options=None, **kwargs):
self.gpu_fit = options['gpu-fit']

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Won't this fail if options is not supplied, since it will try to access a NoneType object as if it were a dict? Shouldn't the default be options={'gpu-fit': False, 'gpu-create': False} or similar?

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

no they are guaranteed to be there by construction

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I suppose it's only a kwarg for readability then? In practice it is mandatory (and thus more like a positional arg)?

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

IIRC, it's because all passes accept just one arg (the list of clusters, or the IET) and multiple kwargs. But anyway, legacy might be hitting us here. Anyway, nitpicking

mloubout force-pushed the index-mode branch 2 times, most recently from c77cdb8 to 018ce5a Compare July 15, 2025 14:16
mloubout merged commit b19e707 into main Jul 15, 2025
35 of 36 checks passed
mloubout deleted the index-mode branch July 15, 2025 18:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL