-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[flang][NFC] Characterize allocation based on MemAlloc effect instead of pattern matching #166806
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
05e4d39
first implementation
SusanTan 0295bd1
replace the main memalloc
SusanTan 4e64702
refactor
SusanTan d4ffa26
cleanup
SusanTan 163cda5
rm unused function
SusanTan 538424c
change cuf
SusanTan 3e21642
change to value base
SusanTan fb74ffd
remove cuf
SusanTan 7c380e1
remove headerfile
SusanTan 99228e3
rm addition in cufops.td
SusanTan caa0cde
remove include
SusanTan 1382cee
tweak on FIROps.td
SusanTan 42fced2
change variable names
SusanTan 704be71
restore FIROps.td
SusanTan df464d8
change the signatura
SusanTan a37b956
Merge remote-tracking branch 'origin' into susant/firaa-cuf
SusanTan d807d66
remove getEffects
SusanTan b9b30f5
change tests
SusanTan c47e2a2
change test
SusanTan a3158e2
remove redundancy
SusanTan 45f03bb
change to fir.call
SusanTan ce3cbaf
remove some fake uses
SusanTan a0ce784
restore checks
SusanTan ca2e56d
change order
SusanTan 80be520
tweak
SusanTan 92e11da
tweak
SusanTan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
22 changes: 22 additions & 0 deletions
22
flang/test/Analysis/AliasAnalysis/cuf-alloc-source-kind.mlir
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // REQUIRES: asserts | ||
| // RUN: fir-opt %s -pass-pipeline='builtin.module(func.func(test-fir-alias-analysis))' -debug-only=fir-alias-analysis --mlir-disable-threading 2>&1 | FileCheck %s | ||
|
|
||
| // Verify that a CUF allocation is recognized as SourceKind::Allocate by | ||
| // fir::AliasAnalysis::getSource. | ||
|
|
||
| module { | ||
| func.func @_QQmain() attributes {fir.bindc_name = "TEST"} { | ||
| // Allocate two independent device arrays and tag the results; with | ||
| // op-scoped MemAlloc handling in AA, these should be classified as | ||
| // Allocate and not alias. | ||
| %a = cuf.alloc !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a1", data_attr = #cuf.cuda<device>, uniq_name = "_QFEa1", test.ptr = "cuf_alloc_a"} -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> | ||
| %b = cuf.alloc !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a2", data_attr = #cuf.cuda<device>, uniq_name = "_QFEa2", test.ptr = "cuf_alloc_b"} -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> | ||
| return | ||
| } | ||
| } | ||
|
|
||
| // CHECK-LABEL: Testing : "_QQmain" | ||
| // Distinct allocations should not alias. | ||
| // CHECK: cuf_alloc_a#0 <-> cuf_alloc_b#0: NoAlias | ||
|
|
||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if we can apply the logic below to operations in general. Operations may have multiple results, so we would not know which result is a new allocation. Even with a single result, I think, an operation can do
MemAllocwithout returning it as a result. Sorry for being pedantic :)Can we instead modify
cuf.allocto attach theMemAlloceffect to its result?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok yea.... that was what I was originally doing but didn't know if it's ok to modify cuf. I'll add @clementval in for review as well then once im done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's ok to modify the op. Just make it in a separate PR maybe.