-
Notifications
You must be signed in to change notification settings - Fork 419
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
Deprecate ref-maybe-const for array formal arguments #22958
Deprecate ref-maybe-const for array formal arguments #22958
Conversation
31d94ec
to
83303c6
Compare
test/arrays/ferguson/semantic-examples/1.5-return-alias-slice-global.chpl
Show resolved
Hide resolved
test/arrays/ferguson/semantic-examples/2-call-modifies-returned-array.chpl
Show resolved
Hide resolved
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.
For the OP / PR message:
-
array argument formals --> array formal arguments [my preference]
-
a ref-maybe-const formal is marked as ref:
"is marked as" --> "is inferred to be" ? -
Please explain your addition of dsiBulkAddNoPreserveInds().
It would also be good to add a comment in the code explaining what it does.
For the cases where you switched the default intent to const
, ex. in ChapelArray.chpl or in tests like test/types/tuple/ferguson/tuple-array-concrete.chpl
, I am curious why not ref
and/or why an explicit intent was needed. I suspect the compiler wants to infer it as ref
? why?
In test/types/tuple/ferguson/tuple-array.chpl
and siblings, how well do you think your changes there preserve the intent of those tests?
test/studies/cholesky/jglewis/version2/elemental/scalar_inner_product_cholesky.chpl
Show resolved
Hide resolved
test/studies/cholesky/jglewis/version2/elemental/scalar_inner_product_cholesky.chpl
Show resolved
Hide resolved
test/studies/graph500/kristyn/Graph500_1D_onV/Graph500_Modules/Verify.chpl
Show resolved
Hide resolved
The space check does not apply to tests. Also, to me trailing space has no impact on the quality of code. Excessive trailing space changes affect the PR review experience, however, and are best done in a separate PR. |
These were both changes I made with @mppf, where the rationale was we are ok forcing users to explicitly mark varargs as |
@vasslitvinov I think I have implemented all of your feedback except the spaces. I will look at separating those out after I resolve the merge conflicts, but I think for this PR it may be more trouble than it is worth at this point |
b19bf79
to
d5e260a
Compare
some are marked notest, they will not be implemented yet Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
currently argThis and taskIntent are disabled, forall intent is not implemented Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
d5e260a
to
dd93f04
Compare
Woohoo! |
fixes failing tests by adding `ref` where needed in gpu tests. ref-maybe-const was deprecated in #22958. Array formals can no longer be modified with the default intent, an explicit `ref` must now be supplied. This cascades to other functions that may require a `ref` like `c_ptrTo`. Tested with `CHPL_GPU=cpu` Note that `test/gpu/native/studies/sort/radixSortGpu` will not be fully fixed due to prior issue. [Reviewed by @DanilaFe]
Fix issues missed with ref-maybe-const deprecation (#22958). We now require `ref` to be used when modifying an array Added `ref` where needed in python interop tests [Not reviewed - trivial test change]
Deprecates ref-maybe-const for task intents. The compiler will warn when a ref-maybe-const task intent is inferred to be `ref` in `cullOverReferences`. Implements part of the decisions for #21398 (comment) Followup to #22958 ## Summary of changes - enable warning for task intents - add extra logic to handle task variables for record method receivers and nested functions. - add explicit task variables where needed in modules and tests on `coforall` and `[co]begin` ## New tests - add `test/deprecated/ref-maybe-const-task-intents.chpl` ## Testing - paratest with futures - paratest with gasnet [Reviewed by @vasslitvinov] closes Cray/chapel-private#5253
Deprecates ref-maybe-const for this intents. The compiler will warn when a method receiver is modified without explicitly marking the method as `ref`. Implements part of the decisions for #21398 (comment) This PR also exposes a bug with records ```chapel record R1 { var x: int; proc /*ref*/ foo() do x = 17; } record R2 { var x: R1; proc bar() do return x; } var r = new R2(); r.bar().foo(); writeln(r); ``` With `ref-maybe-const`, this code compiled when it should have failed to compile. Using an explicit `ref` intent causes user code that previously worked (incorrectly) to break. The deprecation warning ignores methods which use `pragma "reference to const when const this"`. Followup to #22958 and #23049 ## Summary of changes - enable warning for this intents - add an explicit `ref` where needed in modules and tests on methods ## New tests - enable `test/deprecated/ref-maybe-const-this-intents.chpl` ## Testing - paratest with futures - paratest with gasnet [Reviewed by @vasslitvinov]
Deprecates ref-maybe-const for `forall` intents. The compiler will warn when an array is used in a modifiable context inside of a forall loop. For example passing the array to a function which takes a `ref` argument or assigning the array to a `ref` var. Implements the rest of the decisions for #21398 (comment) Followup to #22958, #23049, and #23060 ## Summary of changes - enable warning for forall intents - add an explicit `ref` where needed in modules and tests on foralls - for tests in `test/optimizations/autoLocalAccess` and `test/optimizations/autoAggregation`, added a PREDIFF pending a fix for the optimizations tested here - using an explicit `ref` shadow variable for these causes the optimization to fail, this is a temporary solution until the optimization is fixed. - enable `test/deprecated/ref-maybe-const-forall-intents.chpl` - futurize `test/gpu/native/distArray/blockInsideOn.chpl` - using a forall with a shadow var for a distributed array inside of an `on gpu` block makes the loop gpu ineligible ## Testing - [x] paratest with futures - [x] paratest with gasnet - [x] gpu testing - [x] nvidia with UM - [x] amd with AOD - [x] paratest with c backend on nightly test machine [Reviewed by @vasslitvinov] closes #21398 closes Cray/chapel-private#5093
…23228) Adds explicit ref forall intents where needed due to the ref-maybe-const forall intent deprecation (#23175). While there, also reverted accidental changes made to submitted tests due to ref-maybe-const array formals in (#22958). Some submitted performance tests use verify the results using a line number, those were updated as well. While there, added a `use Math` for some tests still using `exp` from `AutoMath`. Tested files locally where applicable. Also tested submitted tests with `--performance` [Reviewed by @e-kayrakli]
Updates documentation for `bulkAdd` and `bulkAddNoPreserveInds`, which where modified in #22958. [Reviewed by @dlongnecke-cray]
Deprecates ref-maybe-const for array formal arguments. Compiler will warn when a ref-maybe-const formal is inferred to be
ref
incullOverReferences
. This will not warn for compiler generated functions or outer variables (when outlining nested functions). It is written in a way that exceptions can be removed to implement other ref-maybe-const deprecations.Implements part of the decisions for #21398 (comment)
Summary of changes
ref
orconst
) where needed in modules and testsref a = ...
toconst ref a = ...
)compiler/passes/expandExternArrayCalls.cpp
to interpret intents and usec_ptrConst
.compiler/passes/normalize.cpp
to fix lvalue error withconvertToExternalArray
.bulkAdd
for sparse domains to prefer codepaths that do not requiresort
inds
to be marked asref
preserveInds
boolean argument, now there is a separatebulkAddNoPreserveInds
c_ptrTo
toc_ptrToConst
where applicableNew tests
test/deprecated/ref-maybe-const.chpl
test/functions/ferguson/ref-pair/ifexpr/ifexpr2-1.chpl
test/users/ibertolacc/void_extern_proc_array_ref.chpl
Testing
[Reviewed by @vasslitvinov]
closes Cray/chapel-private#5218