Skip to content

Add BuddyExt#5

Draft
trdthg wants to merge 4 commits into
RuyiAI-Stack:mainfrom
trdthg:buddy-mlir-backend
Draft

Add BuddyExt#5
trdthg wants to merge 4 commits into
RuyiAI-Stack:mainfrom
trdthg:buddy-mlir-backend

Conversation

@trdthg
Copy link
Copy Markdown

@trdthg trdthg commented Apr 20, 2026

No description provided.

XYenChi added 3 commits April 17, 2026 18:47
…opsrun test (llvm#4)

Fix three issues found on RISC-V:

1. Fix use-after-free in block walk (Visitors.h)

When walking blocks with ReverseDominanceIterator, the Traversal object
returned by Iterator::makeIterable(region) was passed as a temporary
directly to llvm::make_early_inc_range(). The temporary was destroyed at
the end of the full expression while iterators from make_early_inc_range
still referenced it. Store the result in a local variable with auto&& to
extend the lifetime of the temporary and bind lvalue references for
ForwardIterator.

2. Fix Shape dialect CstrBroadcastableOp fold and cast canonicalization

Extend getShapeVec to look through tensor.cast operations so that folds
can resolve shapes behind casts inserted by earlier canonicalization
passes (e.g., ShapeOfOpToConstShapeOp). Add a new fold check in
CstrBroadcastableOp::fold that recognizes broadcasting is trivially
valid when at most one operand is non-scalar (resolved via getShapeVec).
Rewrite CanonicalizeCastExtentTensorOperandsPattern to use
modifyOpInPlace instead of replaceOpWithNewOp to avoid issues with
op builder template instantiation.

3. Fix opsrun.py test invocation pattern for multithreaded_tests.py

Convert direct test_foo() calls to run(test_foo) so that
copy_and_update in multithreaded_tests.py properly strips them during
import, preventing JIT execution at module load time which crashes on
RISC-V due to R_RISCV_HI20 relocation range limits.
@trdthg trdthg force-pushed the buddy-mlir-backend branch from f04550b to cae61e8 Compare April 20, 2026 12:27
@trdthg trdthg force-pushed the buddy-mlir-backend branch from cae61e8 to 5faa117 Compare April 20, 2026 12:27
@yuzibo yuzibo force-pushed the main branch 5 times, most recently from 4ab1448 to 4851970 Compare May 9, 2026 07:48
@WuXintong123 WuXintong123 force-pushed the main branch 7 times, most recently from 9f45e3c to 1e7ae41 Compare May 14, 2026 14:17
WuXintong123 pushed a commit that referenced this pull request May 14, 2026
llvm#183506 revealed a pre-existing
use-after-scope in createInstrInfo (MSan bot:
https://lab.llvm.org/buildbot/#/builders/164/builds/21562 [*]).

This patch fixes the issue by changing the stack-allocated
AArch64Subtarget (which goes out of scope once createInstrInfo()
returns) into heap-allocated, allowing it to be safely stored in the
returned AArch64InstrInfo.

-----

[*] WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x55555666fabd in
llvm::AArch64InstrInfo::getInstSizeInBytes(llvm::MachineInstr const&)
const
/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:247:5
...

/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/unittests/Target/AArch64/InstSizes.cpp:85:3
#9 0x555556508559 in InstSizes_MOVaddrTagged_Test::TestBody()
/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/unittests/Target/AArch64/InstSizes.cpp:301:3
...

  Member fields were destroyed
#0 0x555556498a1d in __sanitizer_dtor_callback_fields
/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:1074:5
#1 0x5555564fbda6 in ~Triple
/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/TargetParser/Triple.h:348:12
#2 0x5555564fbda6 in ~Triple
/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/TargetParser/Triple.h:47:7
#3 0x5555564fbda6 in llvm::AArch64Subtarget::~AArch64Subtarget()
/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/AArch64/AArch64Subtarget.h:38:7
#4 0x555556503396 in (anonymous
namespace)::createInstrInfo(llvm::TargetMachine*)
/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/unittests/Target/AArch64/InstSizes.cpp:38:1
#5 0x5555565084cb in InstSizes_MOVaddrTagged_Test::TestBody()
/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/unittests/Target/AArch64/InstSizes.cpp:299:42
@WuXintong123 WuXintong123 force-pushed the main branch 8 times, most recently from c50a52c to 98bad71 Compare May 22, 2026 14:05
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.

2 participants