Skip to content

Conversation

@cbalint13
Copy link
Contributor

@cbalint13 cbalint13 commented May 12, 2025

This fixes the issue described in #17916


  • Fall to a standard ORCJIT linker (from RTDyldLinker, introduced by MSWIN case), but still cope with COFF cases.
  • Incorporates #17853, that prior info also allows parser simplification, to just read all infos from LLVM side.

The basic relax demo now runs fine, tested with llvm = {19,20}:

$ git diff docs/get_started/tutorials/quick_start.py
{...}
-target = tvm.target.Target("llvm")
+target = tvm.target.Target("llvm -mattr=+m,+a,+f,+d,+zfh,+v,+c")
{...}

$ python3 docs/get_started/tutorials/quick_start.py
# from tvm.script import ir as I
# from tvm.script import relax as R

@I.ir_module
class Module:
    @R.function
    def forward(x: R.Tensor((1, 784), dtype="float32"), fc1_weight: R.Tensor((256, 784), dtype="float32"), 
fc1_bias: R.Tensor((256,), dtype="float32"), fc2_weight: R.Tensor((10, 256), dtype="float32"),
 fc2_bias: R.Tensor((10,), dtype="float32")) -> R.Tensor((1, 10), dtype="float32"):
        R.func_attr({"num_input": 1})
        with R.dataflow():
            permute_dims: R.Tensor((784, 256), dtype="float32") = R.permute_dims(fc1_weight, axes=None)
            matmul: R.Tensor((1, 256), dtype="float32") = R.matmul(x, permute_dims, out_dtype="void")
            add: R.Tensor((1, 256), dtype="float32") = R.add(matmul, fc1_bias)
            relu: R.Tensor((1, 256), dtype="float32") = R.nn.relu(add)
            permute_dims1: R.Tensor((256, 10), dtype="float32") = R.permute_dims(fc2_weight, axes=None)
            matmul1: R.Tensor((1, 10), dtype="float32") = R.matmul(relu, permute_dims1, out_dtype="void")
            add1: R.Tensor((1, 10), dtype="float32") = R.add(matmul1, fc2_bias)
            gv: R.Tensor((1, 10), dtype="float32") = add1
            R.output(gv)
        return gv

[[25018.53  25440.596 24398.615 22915.344 25457.54  25424.28  25661.27
  24288.602 25659.234 23134.854]]

$ rpm -q llvm-devel
llvm-devel-20.1.2-3.fc42.riscv64

$ uname -a
Linux lpi3a 6.6.87-200.spacemit_bl2.1.fc41.riscv64 #1 SMP PREEMPT_DYNAMIC {..} riscv64 GNU/Linux

@cbalint13 cbalint13 force-pushed the rvv-reloc branch 2 times, most recently from a1fa698 to 28ce253 Compare May 12, 2025 13:45
@cbalint13 cbalint13 marked this pull request as ready for review May 12, 2025 17:47
@cbalint13
Copy link
Contributor Author

cc @Hzfengsy @Lunderberg @mshr-h
cc @tqchen

@tqchen tqchen merged commit beca091 into apache:main May 12, 2025
16 of 17 checks passed
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