Skip to content

Commit

Permalink
Merge branch 'main' into dev/daiki/fabric_pkt_hdr_optim
Browse files Browse the repository at this point in the history
  • Loading branch information
daminakaTT authored Feb 18, 2025
2 parents a163057 + ed210e7 commit f7b8c96
Show file tree
Hide file tree
Showing 85 changed files with 2,271 additions and 2,596 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/build-artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,16 @@ on:
#ci-test-docker-image:
# description: "Docker tag for the CI Test Docker image for testing TT-Metalium et al"
# value: ${{ jobs.build-docker-image.outputs.ci-test-tag }}
packages-artifact-name:
description: "Name to give download-artifact to get the packages"
value: ${{ jobs.build-artifact.outputs.packages-artifact-name }}
build-artifact-name:
description: "Name of the published build artifact"
value: ${{ jobs.build-artifact.outputs.build_artifact_name }}
wheel-artifact-name:
description: "Name of the published wheel artifact"
value: ${{ jobs.build-artifact.outputs.wheel_artifact_name }}


workflow_dispatch:
inputs:
build-type:
Expand Down Expand Up @@ -114,6 +116,7 @@ jobs:
- build
- in-service
outputs:
packages-artifact-name: ${{ steps.set-artifact-name.outputs.name }}
build_artifact_name: ${{ steps.set_build_artifact_name.outputs.build_artifact_name }}
wheel_artifact_name: ${{ steps.set_wheel_artifact_name.outputs.wheel_artifact_name }}
container:
Expand Down Expand Up @@ -149,11 +152,22 @@ jobs:
exit 1
fi
- name: Set artifact name
id: set-artifact-name
run: |
TOOLCHAIN="${{ inputs.toolchain }}"
TOOLCHAIN_CLEANED=$(echo "$TOOLCHAIN" | sed -E 's/^cmake\///; s/-toolchain\.cmake$//')
ARTIFACT_NAME="packages-${{ inputs.distro }}-${{ inputs.version }}-${{ inputs.architecture }}-${{ inputs.build-type }}-${TOOLCHAIN_CLEANED}${{ (inputs.tracy && '_profiler') || '' }}"
echo "name=$ARTIFACT_NAME" >> "$GITHUB_OUTPUT"
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> "$GITHUB_ENV"
- name: ⬇️ Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
fetch-depth: 500 # Need enough history for `git describe`
fetch-tags: true # Need tags for `git describe`
path: docker-job # Here be dragons; keep it scoped to our desired volume, yet must be under github.workspace and be sure to clean up at the end

- name: Sanity check
Expand Down Expand Up @@ -194,9 +208,9 @@ jobs:
nice -19 cmake --build build --target install
- name: 📦 Package
if: false # Packaging coming later
run: |
nice -19 cmake --build $build_dir --target package
nice -n 19 cmake --build build --target package
ls -1sh build/*.deb build/*.ddeb
- name: 🐍 Build wheel
if: ${{ inputs.build-wheel }}
Expand All @@ -210,6 +224,16 @@ jobs:
ccache -s >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: ☁️ Upload packages
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: |
/work/build/*.deb
/work/build/*.ddeb
compression-level: 0
if-no-files-found: error

- name: Set wheel artifact name
id: set_wheel_artifact_name
run: |
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/cpp-post-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ jobs:
{name: eth, cmd: "./build/test/tt_metal/unit_tests_eth_${{ inputs.arch }}"},
{name: llk, cmd: "./build/test/tt_metal/unit_tests_llk"},
{name: stl, cmd: "./build/test/tt_metal/unit_tests_stl"},
{name: distributed, cmd: "./build/test/tt_metal/distributed/distributed_unit_tests_${{ inputs.arch }} --gtest_filter=MeshDeviceSuite.*"},

{name: distributed, cmd: "./build/test/tt_metal/distributed/distributed_unit_tests_${{ inputs.arch }}"},
{name: lightmetal, cmd: "./build/test/tt_metal/unit_tests_lightmetal"},
{name: dispatch multicmd queue, cmd: "TT_METAL_GTEST_NUM_HW_CQS=2 ./build/test/tt_metal/unit_tests_dispatch_${{ inputs.arch }} --gtest_filter=MultiCommandQueue*Fixture.*"},

{name: ttnn cpp unit tests, cmd: ./build/test/ttnn/unit_tests_ttnn},
{name: ttnn ccl cpp unit tests, cmd: ./build/test/ttnn/unit_tests_ttnn_ccl},
{name: ttnn tensor cpp unit tests, cmd: ./build/test/ttnn/unit_tests_ttnn_tensor},
Expand Down
22 changes: 18 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ project(
DESCRIPTION "Tenstorrent Metalium"
HOMEPAGE_URL "https://github.com/tenstorrent/tt-metal"
LANGUAGES
C # Some of the jit-build files are plain C
CXX
)
message(STATUS "Metalium version: ${PROJECT_VERSION}")
Expand Down Expand Up @@ -242,6 +243,11 @@ else()
add_compile_definitions(TT_ENABLE_LIGHT_METAL_TRACE=0)
endif()

include(GNUInstallDirs)
# GNUInstallDirs takes PROJECT_DIR verbatim, but directories should always be lowercase
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
string(REPLACE ${PROJECT_NAME} ${PROJECT_NAME_LOWER} CMAKE_INSTALL_DOCDIR ${CMAKE_INSTALL_DOCDIR})

if(ENABLE_CODE_TIMERS)
add_compile_definitions(TT_ENABLE_CODE_TIMERS)
endif()
Expand All @@ -265,7 +271,6 @@ endif()
# For top level install: cmake --build build --target install or make/ninja install -C build
############################################################################################################################
# Install for build artifacts that will upload build/lib
include(GNUInstallDirs)

install(
TARGETS
Expand All @@ -274,7 +279,7 @@ install(
DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT dev
COMPONENT tar
)
install(
TARGETS
Expand All @@ -283,7 +288,7 @@ install(
DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT dev
COMPONENT tar
)
install(
TARGETS
Expand All @@ -292,7 +297,7 @@ install(
DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT dev
COMPONENT tar
)
if(WITH_PYTHON_BINDINGS)
# Install .so into src files for pybinds implementation
Expand All @@ -306,6 +311,15 @@ if(WITH_PYTHON_BINDINGS)
)
endif()

# FIXME(17578): figure out what bits we actually need to ship and omit the rest
install(
DIRECTORY
runtime
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/tt-metalium
USE_SOURCE_PERMISSIONS
COMPONENT jit-build
)

# Custom clean target for `built` folder for when new kernel changes are pulled
add_custom_target(
clean-built
Expand Down
6 changes: 4 additions & 2 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,12 @@ models/demos/t3000/mixtral8x7b @yieldthought @mtairum @uaydonat
models/demos/tg/llama3_70b @cglagovichTT @uaydonat @johanna-rock-tt @djordje-tt @kpaigwar
models/demos/tg/falcon7b @skhorasganiTT @djordje-tt @uaydonat
models/demos/grayskull @uaydonat
models/demos/yolov4 @dvartaniansTT @tenstorrent/metalium-developers-convolutions
models/demos/wormhole/yolov4 @dvartaniansTT @tenstorrent/metalium-developers-convolutions
models/demos/yolov4 @dvartaniansTT @mbahnasTT @tenstorrent/metalium-developers-convolutions
models/demos/wormhole/yolov4 @dvartaniansTT @mbahnasTT @tenstorrent/metalium-developers-convolutions
models/demos/**/*resnet* @tt-aho @tenstorrent/metalium-developers-convolutions
models/experimental/functional_unet @esmalTT @uaydonat @tenstorrent/metalium-developers-convolutions
models/experimental/functional_vit @mbahnasTT @uaydonat
models/demos/segformer @mbahnasTT @uaydonat @tenstorrent/metalium-developers-convolutions
models/perf/ @uaydonat
models/perf/perf_report.py @yieldthought @uaydonat
models/perf/benchmarking_utils.py @skhorasganiTT
Expand Down
57 changes: 54 additions & 3 deletions cmake/packaging.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "[email protected]")
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
set(CPACK_GENERATOR DEB)
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CMAKE_PROJECT_HOMEPAGE_URL "https://tenstorrent.com")
set(CPACK_PACKAGE_NAME tt)

set(CPACK_COMPONENT_METALIUM_DESCRIPTION "TT-Metalium runtime library")
set(CPACK_DEBIAN_METALIUM_PACKAGE_SECTION "libs")

set(CPACK_DEB_COMPONENT_INSTALL YES)
set(CPACK_DEBIAN_PACKAGE_VERSION "${VERSION_DEB}")
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)

set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
# set(CPACK_DEBIAN_DEBUGINFO_PACKAGE TRUE)
set(CPACK_DEBIAN_METALIUM_DEBUGINFO_PACKAGE TRUE)
set(CPACK_DEBIAN_JIT-BUILD_DEBUGINFO_PACKAGE FALSE) # Some binaries don't have a Build ID; we cannot split dbgsyms

set(CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ
WORLD_EXECUTE
)

set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS TRUE)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS FALSE)

get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
list(
REMOVE_ITEM
CPACK_COMPONENTS_ALL
umd-dev # FIXME: -dev packages will come later
tt_pybinds # Wow this one is big!
tar # TODO: Remove that tarball entirely
# Deps that define install targets that we can't (or haven't) disabled
msgpack-cxx
Headers
Library
Unspecified # TODO: audit if there's anything we need to ship here
)

# Logically we should ship jit-build with metalium-runtime, but jit-build fails to split dbgsyms for now (lacking a Build ID on the binaries)
cpack_add_component(jit-build GROUP metalium-jit)

cpack_add_component(metalium-runtime GROUP metalium)
cpack_add_component(umd-runtime GROUP metalium)
cpack_add_component(dev GROUP metalium) # FIXME: delete this line when we bump UMD submodule
cpack_add_component_group(metalium)

cpack_add_component(gtest GROUP metalium-validation)
cpack_add_component_group(metalium-validation)

include(CPack)
5 changes: 5 additions & 0 deletions cmake/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,25 @@ function(ParseGitDescribe)
endif()

set(VERSION_FULL "${VERSION_NUMERIC}")
set(VERSION_DEB "${VERSION_NUMERIC}")
if(VERSION_STATUS)
string(APPEND VERSION_FULL "-${VERSION_STATUS}")
string(APPEND VERSION_DEB "~${VERSION_STATUS}") # Debian versioning uses a ~ for "less than blank"
endif()
if(VERSION_COMMIT_COUNT)
string(APPEND VERSION_FULL "+${VERSION_COMMIT_COUNT}.${VERSION_HASH}")
string(APPEND VERSION_DEB "+${VERSION_COMMIT_COUNT}.${VERSION_HASH}")
endif()
if(VERSION_DIRTY)
string(APPEND VERSION_FULL "+m")
string(APPEND VERSION_DEB "+m")
endif()

message(STATUS "Version: ${VERSION_FULL}")

# Output variables
set(VERSION_FULL "${VERSION_FULL}" PARENT_SCOPE)
set(VERSION_DEB "${VERSION_DEB}" PARENT_SCOPE)
set(VERSION_NUMERIC "${VERSION_NUMERIC}" PARENT_SCOPE)
set(VERSION_HASH "${VERSION_HASH}" PARENT_SCOPE)
endfunction()
1 change: 1 addition & 0 deletions dockerfile/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
clang-tidy-17 \
curl \
dialog \
file \
graphviz \
jq \
pandoc \
Expand Down
2 changes: 1 addition & 1 deletion models/demos/llama3/tt/llama_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def __init__(
pt_wo = self.state_dict[f"{wo_str}.weight"].transpose(-1, -2).unsqueeze(0).unsqueeze(0)

wo_mem_config = configuration.create_dram_sharded_mem_config(
configuration.dim // configuration.num_devices, configuration.dim
(configuration.n_heads * configuration.head_dim) // configuration.num_devices, configuration.dim
)

self.wo = ttnn.as_tensor(
Expand Down
1 change: 0 additions & 1 deletion tests/scripts/run_tt_eager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
TestEntry("tt_eager/tests/ops/test_eltwise_binary_op", "ops/test_eltwise_binary_op"),
TestEntry("tt_eager/tests/ops/test_bcast_op", "ops/test_bcast_op"),
TestEntry("tt_eager/tests/ops/test_sliding_window_ops", "ops/test_sliding_window_ops"),
TestEntry("tt_eager/tests/ops/test_conv_prepare_weights_and_biases", "ops/test_conv_prepare_weights_and_biases"),
TestEntry("tt_eager/tests/ops/test_bmm_op", "ops/test_bmm_op"),
void_for_bh(void_for_whb0(TestEntry("tt_eager/tests/ops/test_eltwise_unary_op", "ops/test_eltwise_unary_op"))),
TestEntry("tt_eager/tests/ops/test_layernorm_op", "ops/test_layernorm_op"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1622,8 +1622,6 @@ def test_conv2d_localrun(device, input_spec):
[1, 768, 3, 224, 224, 32, 32, 32, 32, 0, 0, 1, 1, 1, False], # 1460
[1, 768, 3, 224, 224, 32, 32, 32, 32, 0, 0, 1, 1, 1, True], # 1461
[1, 768, 3, 384, 512, 32, 32, 32, 32, 0, 0, 1, 1, 1, True], # 1464
[1, 64, 3, 720, 1280, 7, 7, 2, 2, 3, 3, 1, 1, 1, False], # 1471
[1, 64, 3, 800, 1088, 7, 7, 2, 2, 3, 3, 1, 1, 1, False], # 1472
[1, 1, 64, 480, 640, 3, 3, 1, 1, 1, 1, 1, 1, 1, True], # 1495
[1, 64, 64, 480, 640, 3, 3, 1, 1, 1, 1, 1, 1, 1, True], # 1496
]
Expand Down
1 change: 0 additions & 1 deletion tests/tt_eager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ set(TT_EAGER_TESTS_OPS
ops/test_sfpu.cpp
ops/test_sliding_window_ops.cpp
ops/test_fold_op.cpp
ops/test_conv_prepare_weights_and_biases.cpp
)

set(TT_EAGER_TESTS_TENSORS
Expand Down
Loading

0 comments on commit f7b8c96

Please sign in to comment.