Some GPU backends (SPIR-V) lower memrefs to bare pointers, so for dynamically sized/strided memrefs it will fail.
This pass extracts sizes and strides via memref.extract_strrided_metadata outside gpu.launch body and do index/offset calculation explicitly and then reconstructs memrefs via memref.reinterpret_cast.
memref.reinterpret_cast then lowered via https://reviews.llvm.org/D155011
anon ns and static is redundant.
The preferred mechanism in LLVM is static, could you drop the ns ?