Repository navigation
[Codegen][ROCDL] Drop nominal support for dynamic shared mem - #20805
Conversation
There was a problem hiding this comment.
I am wondering if you also need to (should) remove the runtime aspects of #8405 like removing it from rocm schema and not relying on it at runtime?
|
We definitely don't want to remove it for CUDA (since that's still needed for the WaR). I don't see the harm in keeping it for hip though since we'd need it if we actually did support dynamic shared memory. Maybe @AWoloszyn or @benvanik have thoughts. |
|
if we actually do use dynamic memory it won't be using this mechanism at all - it'll likely be a new dynamic dispatch parameter we don't currently have that needs to be exposed all the way through the HAL (iree_hal_command_buffer_dispatch will need to grow an attrs field or something silly) |
|
I see, ok we can drop the runtime changes too, but IIUC we might want to pick a tactical time to update the schema (compiler changes can happen whenever). |
|
you can remove the runtime handling and update the schema to have |
MaheshRavishankar
left a comment
There was a problem hiding this comment.
yeah, this makes sense!
|
Ugh, regressions look real. I have a guess but will convert to draft for now. |
|
Re regressions - I notice this PR doesn't actually remove us asking for dynamic shared memory at runtime Thas means you're probably requesting double the LDS you actually need, which could be causing regressions |
It's not double requesting because then I would be hitting launch failures with >= half the maximum shared memory and I'm not. Looking at the ISA I'm seeing a big spike in register usage (e.g. 149 -> 250) but it's not clear to me where those extra registers are going. I suspect it has to do with not flattening our allocations (which this dynamic thing does along the way). |
|
@krzysz00 looks like your hunch about alignment was right though. Comparing the optimized llvm IR with and without this change reveals that the only difference is alignment of accesses: https://gist.github.com/qedawkins/1fbda1133f3a6cc162969360b2f65cad |
|
Lol, it's this: Hard coded alignment fixup. |
This was introduced for CUDA to work around static allocation limits (see iree-org#8317) and then subsequently cloned for ROCM. There is no such allocation limit on the AMD side and we don't actually support dynamic shared memory, so we can drop it. Immediately this fixes issues where multiple exported functions will request the sum of the memory required across all functions because the dynamic symbol obfuscates the actual required amount.
9bf5b30 to
9bdefa2
Compare
Code has changed non-trivially since the review
nirvedhmeshram
left a comment
There was a problem hiding this comment.
LGTM % few minor comments/questions that you can address however.
|
I'll send a follow up to move alignment annotations earlier on. I didn't want to do that in this PR because I have to go through any alloc adjusting patterns and make sure they retain the alignment. Too much for this change, and the hack to keep the same (16) alignment is basically NFC since it's what we already do. |
…ree-org#20805)" This reverts commit d7bb36b. Issue Tracker: iree-org#21019 Signed-off-by: Praveen G <[email protected]>
#21020) …(#20805)" This reverts commit d7bb36b. Issue Tracker: #21019 Signed-off-by: Praveen G <[email protected]>
iree-org#21020) …(iree-org#20805)" This reverts commit e43c555.
iree-org#21020) …(iree-org#20805)" This reverts commit e43c555. Signed-off-by: MaheshRavishankar <[email protected]>
This was introduced for CUDA to work around static allocation limits (see #8317) and then subsequently cloned for ROCM. There is no such allocation limit on the AMD side and we don't actually support dynamic shared memory, so we can drop it. Immediately this fixes issues where multiple exported functions will request the sum of the memory required across all functions because the dynamic symbol obfuscates the actual required amount. To avoid regressions, this matches the current behavior of forcing all shared memory allocations to be aligned by 16. Runtime support for dynamic shared is dropped and the `block_shared_memory_size` field in the flatbuffer is marked as deprecated. To retain load time checking of shared memory resource constraints, we now query exported functions directly using `hipFuncGetAttribute(..., HIP_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES)`.
#21020) …(#20805)" This reverts commit d7bb36b. Issue Tracker: #21019 Signed-off-by: Praveen G <[email protected]>
This was introduced for CUDA to work around static allocation limits (see #8317) and then subsequently cloned for ROCM. There is no such allocation limit on the AMD side and we don't actually support dynamic shared memory, so we can drop it.
Immediately this fixes issues where multiple exported functions will request the sum of the memory required across all functions because the dynamic symbol obfuscates the actual required amount.
To avoid regressions, this matches the current behavior of forcing all shared memory allocations to be aligned by 16. Runtime
support for dynamic shared is dropped and the
block_shared_memory_sizefield in the flatbuffer is marked as deprecated. Toretain load time checking of shared memory resource constraints, we now query exported functions directly using
hipFuncGetAttribute(..., HIP_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES).