Skip to content

Competing pto-isa versions #216

Description

@fiskrt

When compiling a kernel, bisheng sees two pto-isa includes:

  1. ASCEND_HOME_PATH/include/pto/common which comes with the CANN installation,

  2. and our local cmake pto-isa version defined in the cmake through FetchContent.

pto-kernels/CMakeLists.txt

Lines 149 to 154 in 989e0eb

FetchContent_Declare(
libpto_isa_headers
GIT_REPOSITORY https://gitcode.com/cann/pto-isa.git
GIT_TAG v9.0.0)
FetchContent_Populate(libpto_isa_headers)

It's not really possible to avoid the first one completely, even if we set the -I to ours first.

Because bisheng --asc-aicore-lang mode hardcodes /usr/local/Ascend/cann-9.0.0/aarch64-linux/include as include path. So it never sees our local pto-isa.

Reproduce

printf '' > /tmp/empty_probe.cpp
# compile the kernel with -I includes pointing to our local pto-isa
/usr/local/Ascend/cann-9.0.0/bin/bisheng -DMEMORY_BASE -Dno_workspace_kernel_EXPORTS -I/mounted_home/pto-kernels/build/cp311-cp311-linux_aarch64/_deps/libpto_isa_headers-src/include/pto/common -I/mounted_home/pto-kernels/build/cp311-cp311-linux_aarch64/_deps/libpto_isa_headers-src/include -I/include -I/usr/local/Ascend/driver/kernel/inc -fPIC -O0 -g -D_FORTIFY_SOURCE=2 -O2 -std=c++17 -Wno-macro-redefined -Wno-ignored-attributes -fstack-protector-strong --npu-arch=dav-2201 -H -o /tmp/kfa_probe.o -c --asc-aicore-lang /mounted_home/pto-kernels/csrc/kernel/kernel_fa.cpp 2>&1 | grep -nE 'TPush\.hpp|pto_instr_impl\.hpp|pto-inst\.hpp' | head -40
# see how the include paths are 1:. /usr/local/Ascend/cann-9.0.0/aarch64-linux/include/pto/pto-inst.hpp

# now rename the CANN pto so it can't be found by bisheng
mv /usr/local/Ascend/cann-9.0.0/aarch64-linux/include/pto/ /usr/local/Ascend/cann-9.0.0/aarch64-linux/include/pto2/

# re-run compilation, and we see the pto-isa path points to ours
/usr/local/Ascend/cann-9.0.0/bin/bisheng -DMEMORY_BASE -Dno_workspace_kernel_EXPORTS -I/mounted_home/pto-kernels/build/cp311-cp311-linux_aarch64/_deps/libpto_isa_headers-src/include/pto/common -I/mounted_home/pto-kernels/build/cp311-cp311-linux_aarch64/_deps/libpto_isa_headers-src/include -I/include -I/usr/local/Ascend/driver/kernel/inc -fPIC -O0 -g -D_FORTIFY_SOURCE=2 -O2 -std=c++17 -Wno-macro-redefined -Wno-ignored-attributes -fstack-protector-strong --npu-arch=dav-2201 -H -o /tmp/kfa_probe.o -c --asc-aicore-lang /mounted_home/pto-kernels/csrc/kernel/kernel_fa.cpp 2>&1 | grep -nE 'TPush\.hpp|pto_instr_impl\.hpp|pto-inst\.hpp' | head -40
# 1:. /mounted_home/pto-kernels/build/cp311-cp311-linux_aarch64/_deps/libpto_isa_headers-src/include/pto/pto-inst.hpp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions