# Puzzle 23 CUDA SIMD load, store and basic ops

**URL:** <https://forum.modular.com/t/puzzle-23-cuda-simd-load-store-and-basic-ops/2319>\
**Category:** GPU Programming\
**Tags:** gpu\_puzzle\
**Created:** [October 1, 2025, 7:52am UTC](https://forum.modular.com/t/puzzle-23-cuda-simd-load-store-and-basic-ops/2319 "2025-10-01T07:52:07Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Ehsan](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/ehsan/32/142_2.png) [@Ehsan](https://forum.modular.com/u/Ehsan)\
**Post date:** [October 3, 2025, 10:16pm UTC](https://forum.modular.com/t/puzzle-23-cuda-simd-load-store-and-basic-ops/2319/2 "2025-10-03T22:16:57Z")

</div>

You’re right! Must be `aligned_load/store`. Previously, `LayoutTensor` was missing the `alignment` hence the closure had no idea. That was [fixed](https://forum.modular.com/t/simd-loads-on-the-gpu/2122/2). But I missed changing the load/store after including the alignment.

So with those, the PTX looks like

```txt
        ld.global.nc.v4.b32 {%r4, %r5, %r6, %r7}, [%rd24];
        add.s64 %rd25, %rd2, %rd27;
        ld.global.nc.v4.b32 {%r8, %r9, %r10, %r11}, [%rd25];
        add.f32 %r12, %r7, %r11;
        add.f32 %r13, %r6, %r10;
        add.f32 %r14, %r5, %r9;
        add.f32 %r15, %r4, %r8;
        add.s64 %rd26, %rd3, %rd27;
        st.global.v4.b32 [%rd26], {%r15, %r14, %r13, %r12};

```

> As far as I know this is not supported in CUDA, which GPU architectures currently support this?

It does but is limited. For example, with `alias dtype = bfloat16`, the `SIMD_WIDTH` becomes `8` and

```bash
mojo -D DUMP_GPU_ASM=True solutions/p23/p23.mojo --elementwise

```

we get

```txt
        ld.global.nc.v4.b32 {%r4, %r5, %r6, %r7}, [%rd24];
        add.s64 %rd25, %rd2, %rd27;
        ld.global.nc.v4.b32 {%r8, %r9, %r10, %r11}, [%rd25];
        mov.b32 %r12, 1065369472;
        fma.rn.bf16x2 %r13, %r7, %r12, %r11;
        fma.rn.bf16x2 %r14, %r6, %r12, %r10;
        fma.rn.bf16x2 %r15, %r5, %r12, %r9;
        fma.rn.bf16x2 %r16, %r4, %r12, %r8;
        add.s64 %rd26, %rd3, %rd27;
        st.global.v4.b32 [%rd26], {%r16, %r15, %r14, %r13};

```

---

_[View the full topic](https://forum.modular.com/t/puzzle-23-cuda-simd-load-store-and-basic-ops/2319)._
