perfect, moving on to the next section i have an LSTM layer, I've already implemented…
- User
perfect, moving on to the next section i have an LSTM layer, I've already implemented the layer just need to connect it. But before we move on. use this kernel and implement a matmul with it, multiply the weights of dim 1024 x 640 with input 640 x 1 to get output 1024. compare the results to a cpu implementation and see if it matches, carefully analyze the code see if I can use this for that specific size matmul. #define SMEM_LDA (132) #define SMEM_LDB (128) #define SMEM_LDC (64)
// remove original guard device forceinline void ldg32_nc_0(float& reg, const void* ptr) { asm volatile("{.reg .pred p;\n" "mov.b32 %0, 0;\n" #if CUDACC_VER_MAJOR >= 11 && CUDACC_VER_MINOR >= 4 &&
CUDA_ARCH >= 750 "ld.global.nc.L2::128B.f32 %0, [%1];}\n" #else "ld.global.nc.f32 %0, [%1];}\n" #endif : "=f"(reg) : "l"(ptr)); }device forceinline uint32_t smem_u32addr(const void* smem_ptr) { uint32_t addr; asm("{.reg .u64 u64addr;\n" " cvta.to.shared.u64 u64addr, %1;\n" " cvt.u32.u64 %0, u64addr;}\n" : "=r"(addr) : "l"(smem_ptr));
codereturn addr;}
device forceinline void lds128(float& reg0, float& reg1, float& reg2, float& reg3, const uint32_t& addr) { asm volatile("ld.shared.v4.f32 {%0, %1, %2, %3}, [%4];\n" : "=f"(reg0), "=f"(reg1), "=f"(reg2), "=f"(reg3) : "r"(addr)); }
device forceinline void sts128(const float& reg0, const float& reg1, const float& reg2, const float& reg3, const uint32_t& addr) { asm volatile("st.shared.v4.f32 [%0], {%1, %2, %3, %4};\n" : : "r"(addr), "f"(reg0), "f"(reg1), "f"(reg2), "f"(reg3)); }
device forceinline void stg128(const float& reg0, const float& reg1, const float& reg2, const float& reg3, const float* addr) { asm volatile("st.global.v4.f32 [%0], {%1, %2, %3, %4};\n" : : "l"(addr), "f"(reg0), "f"(reg1), "f"(reg2), "f"(reg3)); }
device forceinline void stg32(const float& reg, const void* ptr) { asm volatile("{.reg .pred p;\n" " st.global.f32 [%0], %1;}\n" : : "l"(ptr), "f"(reg)); }
device forceinline void sts32(const float& reg, const uint32_t& addr) { asm volatile("st.shared.f32 [%0], %1;\n" : : "r"(addr), "f"(reg)); }
/** ping-pong / global launch_bounds(256, 2) void sgemm_128x128x8(int m, int n, int k, const float a, const float* b, float* c) {
code - Assistant