Skip to content

feat(matmul): add MULTI_BLOCK Makefile target for matmul_multi_block.cpp - #73

Closed
Simona787 wants to merge 1 commit into
PTO-ISA:mainfrom
Simona787:feat/add-multi-block-makefile
Closed

feat(matmul): add MULTI_BLOCK Makefile target for matmul_multi_block.cpp#73
Simona787 wants to merge 1 commit into
PTO-ISA:mainfrom
Simona787:feat/add-multi-block-makefile

Conversation

@Simona787

Copy link
Copy Markdown
Contributor

Adds TYPE=MULTI_BLOCK Makefile rule that compiles matmul_multi_block.cpp with configurable M/N/K/tM/tN/tK, MODE, and NBLOCKS parameters.

Enables compilation of multi-block matmul ELFs like:

  • matmul_MULTI_BLOCK_MASK_FP32_M8192_N4096_K1600_tM32_tN32_tK32.elf

Changes:

  • Makefile: add MULTI_BLOCK build target section
  • src/matmul_multi_block.cpp: multi-block matmul source

Adds TYPE=MULTI_BLOCK rule supporting matmul_multi_block.cpp source
with configurable M/N/K/tM/tN/tK, MODE, and NBLOCKS parameters.
Enables compilation of multi-block matmul ELFs like:
  matmul_MULTI_BLOCK_MASK_FP32_M8192_N4096_K1600_tM32_tN32_tK32.elf

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52f6c29e43

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +92 to +94
TARGET = $(ELF_HEAD)/$(NAME)_MULTI_BLOCK_$(MODE)_M$(M)_N$(N)_K$(K)_tM$(tM)_tN$(tN)_tK$(tK).elf
else
TARGET = $(ELF_HEAD)/$(TESTCASE)_MULTI_BLOCK_$(MODE)_M$(M)_N$(N)_K$(K)_tM$(tM)_tN$(tN)_tK$(tK).elf

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Encode NBLOCKS in the output filename

When the same shape and mode are built with different NBLOCKS values, both configurations resolve to the same target path, so the later build overwrites the earlier ELF even though the compiled row partitioning and required runtime thread count differ. This prevents retaining or reliably selecting multiple block-count configurations and can cause an ELF to be executed with the wrong thread count; include NBLOCKS in both target-name branches.

Useful? React with 👍 / 👎.

static_assert(globN % tilN == 0);
static_assert(globK % tilK == 0);

using dtype = float;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject or implement non-FP32 modes

For any invocation such as TYPE=MULTI_BLOCK MODE=MASK_FP16, the Makefile accepts and embeds the mode in the ELF name, but this source always instantiates float inputs. Consumers that select input encoding from the advertised mode will therefore provide half/FP8-sized buffers that the kernel reads as FP32, producing invalid results or reading beyond the supplied data. Either derive dtype from the supported mode macros or reject every mode except MASK_FP32.

Useful? React with 👍 / 👎.

ziyang-cheng added a commit to ziyang-cheng/SuperNPUBench that referenced this pull request Sep 5, 2026
- 基线 ops-20260904(a0ddcc3) + env_test 现构建工具链(model 49547742/llvm 67d3ac98/TileOP f8fb8943)
- 新tag含kernels/重构,5个PR(PTO-ISA#82/PTO-ISA#84/PTO-ISA#39/PTO-ISA#78/PTO-ISA#75)merge冲突=降级不忠实;干净merge PTO-ISA#73/PTO-ISA#79/PTO-ISA#83/#74可信
- gfsim 0->8 新模型真实改善;#74本轮首次可验(moe_dispatch/combine全PASS)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Simona787 Simona787 closed this by deleting the head repository Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant