Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#14590: Move sfpi off LFS #14758

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "src/ckernels/sfpi"]
path = tt_metal/third_party/sfpi
url = https://github.com/tenstorrent-metal/sfpi-rel-temp.git
[submodule "third_party/pybind11"]
path = tt_metal/third_party/pybind11
url = https://github.com/pybind/pybind11.git
Expand Down
12 changes: 11 additions & 1 deletion tt_metal/hw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ set(TYPES
kernel
)

add_custom_target(
tt-rkim marked this conversation as resolved.
Show resolved Hide resolved
sfpi
${CMAKE_CURRENT_SOURCE_DIR}/sfpi.sh ${CMAKE_CURRENT_SOURCE_DIR}/sfpi.version ${CMAKE_CURRENT_SOURCE_DIR}/sfpi.md5
${PROJECT_SOURCE_DIR}/runtime/sfpi
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/sfpi.version
USES_TERMINAL
)

foreach(ARCH IN LISTS ARCHS)
set(DEV_MEM_MAP "${PROJECT_SOURCE_DIR}/tt_metal/hw/inc/${ARCH}/dev_mem_map.h")
set(HW_INCLUDES "${PROJECT_SOURCE_DIR}/tt_metal/hw/inc/${ARCH}")
Expand Down Expand Up @@ -78,7 +87,7 @@ function(get_alias INPUT_STRING OUTPUT_VAR)
endfunction()

# Define the compiler command
set(GPP_CMD ${PROJECT_SOURCE_DIR}/tt_metal/third_party/sfpi/compiler/bin/riscv32-unknown-elf-g++)
set(GPP_CMD ${PROJECT_SOURCE_DIR}/runtime/sfpi/compiler/bin/riscv32-unknown-elf-g++)

set(GPP_DEFINES -DTENSIX_FIRMWARE)

Expand Down Expand Up @@ -189,6 +198,7 @@ foreach(ARCH IN LISTS ARCHS)
${GPP_CMD} ${GPP_FLAGS} ${GPP_DEFINES} ${GPP_INCLUDES} -c -o ${HW_LIB_DIR}/${HWLIB}.o ${${HWLIB}_SOURCE}
DEPENDS
${${HWLIB}_SOURCE}
sfpi
COMMENT "Building hw lib ${HWLIB}.o"
VERBATIM
)
Expand Down
1 change: 1 addition & 0 deletions tt_metal/hw/sfpi.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3ffa5a871a6289f19617de7293c1dac0 sfpi-release.tgz
50 changes: 50 additions & 0 deletions tt_metal/hw/sfpi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#! /bin/bash

# Script to automatically get a specified release. Invoke from your build system providing:
# VERSION file containing desired version
# MD5 file containing md5sum checksum
# DST target directory
# The script is lazy and will not redownload an already-downloaded version

set -eo pipefail

if [[ "$#" != 3 ]] ; then
echo "Usage: $0 VERSIONFILE MD5FILE DSTDIR" 1>&2
exit 1
fi

verfile="$1"
md5file="$2"
dstdir="${3%/sfpi}"

if cmp -s "$verfile" "$dstdir/sfpi/sfpi.version" ; then
# We have this already
touch "$dstdir/sfpi/sfpi.version"
echo "Already have sfpi release $(cat "$verfile")"
exit 0
fi

if which curl >/dev/null ; then
fetcher="curl -L -o - --ftp-pasv --retry 10"
elif which wget > /dev/null ; then
fetcher="wget -O -"
else
echo "No downloader available" 1>&2
exit 1
fi

url=https://github.com/tenstorrent/sfpi/releases/download
read hash tarball < "$md5file"
read ver < "$verfile"

echo "Downloading new sfpi release: $ver/$tarball"
mkdir -p "$dstdir"
$fetcher "$url/$ver/$tarball" > "$dstdir/$tarball"
if ! (cd "$dstdir" ; md5sum -c -) < "$md5file" ; then
echo "MD5 hash mismatch on $dstdir/$tarball" 1>&2
exit 1
fi

(cd "$dstdir" && rm -rf sfpi && tar xzf "$tarball")
echo "$ver" > "$dstdir/sfpi/sfpi.version"
rm -f "$dstdir/$tarball"
1 change: 1 addition & 0 deletions tt_metal/hw/sfpi.version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.0.0-lfsectomy
6 changes: 3 additions & 3 deletions tt_metal/jit_build/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void JitBuildEnv::init(uint32_t build_key, tt::ARCH arch) {
this->out_kernel_root_ = this->out_root_ + to_string(build_key) + "/kernels/";

// Tools
this->gpp_ = this->root_ + "tt_metal/third_party/sfpi/compiler/bin/riscv32-unknown-elf-g++ ";
this->gpp_ = this->root_ + "runtime/sfpi/compiler/bin/riscv32-unknown-elf-g++ ";

// Flags
string common_flags;
Expand Down Expand Up @@ -291,8 +291,8 @@ JitBuildCompute::JitBuildCompute(const JitBuildEnv& env, const JitBuiltStateConf
env_.root_ + "tt_metal/hw/ckernels/" + env.arch_name_ + "/metal/common " + "-I" + env_.root_ +
"tt_metal/hw/ckernels/" + env.arch_name_ + "/metal/llk_io " + "-I" + env_.root_ +
"tt_metal/hw/ckernels/" + env.arch_name_ + "/metal/llk_api " + "-I" + env_.root_ +
"tt_metal/hw/ckernels/" + env.arch_name_ + "/metal/llk_api/llk_sfpu " + "-I" + env_.root_ +
"tt_metal/third_party/sfpi/include " + "-I" + env_.root_ + "tt_metal/hw/firmware/src " + "-I" +
"tt_metal/hw/ckernels/" + env.arch_name_ + "/metal/llk_api/llk_sfpu " + "-I" +
env_.root_ + "runtime/sfpi/include " + "-I" + env_.root_ + "tt_metal/hw/firmware/src " + "-I" +
env_.root_ + "tt_metal/third_party/tt_llk_" + env.arch_name_ + "/llk_lib ";

if (this->is_fw_) {
Expand Down
1 change: 0 additions & 1 deletion tt_metal/third_party/sfpi
Submodule sfpi deleted from 1aab81
Loading