Repository navigation
Conversation
|
/ai-pr-review |
AI PR ReviewReviewed PR: #1055 Verdict
Blocking findings
Non-blocking findings
Evidence gaps
AI review is advisory and does not replace maintainer review or CI. |
| // Emit definitions only for the backends enabled in this translation unit. | ||
|
|
||
| #ifdef WITH_CPU | ||
| #if defined(WITH_CPU) || defined(WITH_TORCH) |
There was a problem hiding this comment.
这个可能是因为你链接的InfiniRT用了CPU编译,InfiniOps没用CPU编译, 所以报错,如果对齐的话,可能不需要这个修改
|
|
||
| # Vendor-specific defines required by forked `torch` headers. | ||
| set(_torch_extra_flags "") | ||
| list(APPEND _torch_extra_flags "-DWITH_TORCH=1") |
There was a problem hiding this comment.
如果instantiate.h不改,这里应该也可以不改
| const std::vector<int64_t> window_size, const double softcap, | ||
| const bool deterministic, const bool return_attn_probs, Tensor out, | ||
| std::optional<Tensor> softmax_lse, std::optional<Tensor> s_dmask) const { | ||
| if (!block_table.has_value()) |
Summary
FlashAttnVarlenFuncandFlashAttnWithKvcache, backed by HPCClibhcFlashAttn.so.src/native/cuda/mars/ops/flash_attn_common.h.scripts/configs/infiniops_ops_mars_llama.jsonfor llama inference, selecting ATenArgmaxat implementation slot 8.hcFlashAttn, filter temporary.cc.cusymlinks, removeCONFIGURE_DEPENDSfrom the Mars source glob, make the offline nlohmann/json path relative, and pass-DWITH_TORCH=1to Torch sources.WITH_TORCH=ON, even when the native CPU backend is disabled.Motivation
Enable the llama inference workflow on Mars/HPCC with both
paged-attnandflash-attn. Using ATen forArgmaxavoids a hand-written Mars reduction kernel. The build changes are needed to link HPCC FlashAttention and to keep the Torch backend self-consistent without enabling the native CPU backend.No linked issue.
Type of Change
feat— new feature / new operator / new platformfix— bug fixperf— performance improvement (no behavioral change)refactor— code restructuring without behavior changetest— adding or fixing tests onlydocs— documentation onlybuild/ci— build system or CI configurationchore— tooling, formatting, or other non-code changes!in the Conventional Commits prefix or aBREAKING CHANGE:footer)Platforms Affected
WITH_MARS)WITH_CPU) — ATen CPU provider instantiation only; native CPU backend behavior is unchangedWITH_NVIDIA)WITH_ILUVATAR)WITH_METAX)WITH_CAMBRICON)WITH_MOORE)WITH_ASCEND)WITH_TORCH)Smoke Test Result
The same InfiniLM smoke command also passed on
tj-metax-24:Test Results on Supported Platforms
flash-attnend-to-end smoke passed; full InfiniOps pytest not runFull `pytest` output (optional)
Benchmark / Performance Impact
N/A. This is not a performance PR. End-to-end tiny-llama smoke timing was about 0.70 s on
tj-metax-23and 0.72 s ontj-metax-24for 2 generated tokens.Notes for Reviewers
mha_fwd_kvcacherequires a valid contiguoussoftmax_lsetensor even when LSE is not returned; the provider allocates a workspace for it.CONFIGURE_DEPENDSbecausehtcc_wrapper.shcreates temporary.cc.cusymlinks. Re-run CMake after adding new Mars source files.WITH_TORCH=ONandINFINI_OPS_TORCH_OPS=argmaxto generate the ATen Argmax provider. The Mars llama profile selects implementation slot 8.