[flang-commits] [flang] [flang] Apply the offload-region stack arrays rule in the allocation policy (PR #228539)
Zhen Wang via flang-commits
flang-commits at lists.llvm.org
Fri Oct 2 11:49:55 PDT 2026
================
@@ -63,9 +65,29 @@ bool fir::shouldUseStackForCopyin(mlir::Location loc, mlir::Type sequenceType,
return shouldAllocateOnStack(info, copyInPolicy, /*stackBytesUsed=*/0);
}
-bool fir::shouldAllocateOnStack(const PendingAllocationInfo &info,
- const AllocationPolicy &policy,
- std::size_t stackBytesUsed) {
+bool fir::isInOffloadRegion(mlir::Operation *op) {
+ for (mlir::Operation *cur = op ? op->getParentOp() : nullptr; cur;
+ cur = cur->getParentOp())
+ if (mlir::isa<mlir::acc::OffloadRegionOpInterface,
+ fir::CUDAKernelOpInterface>(cur))
----------------
wangzpgi wrote:
Good catch, it should. Added gpu.launch, gpu.func, gpu.module and specialized routines to fir::isInOffloadRegion, and added a gpu.launch test.
https://github.com/llvm/llvm-project/pull/228539
More information about the flang-commits
mailing list