diff --git a/tt_metal/impl/CMakeLists.txt b/tt_metal/impl/CMakeLists.txt index 9ff7fab8b41..b11263ca7b9 100644 --- a/tt_metal/impl/CMakeLists.txt +++ b/tt_metal/impl/CMakeLists.txt @@ -7,6 +7,7 @@ set(IMPL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/buffers/circular_buffer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/buffers/semaphore.cpp ${CMAKE_CURRENT_SOURCE_DIR}/kernels/kernel.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/kernels/runtime_args_data.cpp ${CMAKE_CURRENT_SOURCE_DIR}/allocator/algorithms/free_list.cpp ${CMAKE_CURRENT_SOURCE_DIR}/allocator/allocator.cpp ${CMAKE_CURRENT_SOURCE_DIR}/allocator/basic_allocator.cpp diff --git a/tt_metal/impl/kernels/runtime_args_data.cpp b/tt_metal/impl/kernels/runtime_args_data.cpp new file mode 100644 index 00000000000..aa5352498b5 --- /dev/null +++ b/tt_metal/impl/kernels/runtime_args_data.cpp @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#include "tt_metal/impl/kernels/runtime_args_data.hpp" // Public API Header + +#include "tt_metal/common/assert.hpp" + +namespace tt::tt_metal { + +std::uint32_t & RuntimeArgsData::operator[](std::size_t index) { + TT_ASSERT(index < rt_args_count, "Index specified is larger than runtime args size"); + return this->rt_args_data[index]; +} + +const std::uint32_t & RuntimeArgsData::operator[](std::size_t index) const { + TT_ASSERT(index < rt_args_count, "Index specified is larger than runtime args size"); + return this->rt_args_data[index]; +} + +std::uint32_t & RuntimeArgsData::at(std::size_t index) { + TT_FATAL(index < rt_args_count, "Index specified is larger than runtime args size"); + return this->rt_args_data[index]; +} + +const std::uint32_t & RuntimeArgsData::at(std::size_t index) const { + TT_FATAL(index < rt_args_count, "Index specified is larger than runtime args size"); + return this->rt_args_data[index]; +} + +std::uint32_t * RuntimeArgsData::data() noexcept { + return rt_args_data; +} + +const std::uint32_t * RuntimeArgsData::data() const noexcept { + return rt_args_data; +} + +std::size_t RuntimeArgsData::size() const noexcept { + return rt_args_count; +} + +} + diff --git a/tt_metal/impl/kernels/runtime_args_data.hpp b/tt_metal/impl/kernels/runtime_args_data.hpp index 4dd41c00290..88fd4ddea88 100644 --- a/tt_metal/impl/kernels/runtime_args_data.hpp +++ b/tt_metal/impl/kernels/runtime_args_data.hpp @@ -4,7 +4,8 @@ #pragma once -#include "tt_metal/common/assert.hpp" +#include +#include namespace tt::tt_metal { // RuntimeArgsData provides an indirection to the runtime args @@ -12,34 +13,22 @@ namespace tt::tt_metal { // After generation, this points into the cq cmds so that runtime args API calls // update the data directly in the command struct RuntimeArgsData { - uint32_t * rt_args_data; - size_t rt_args_count; - - inline uint32_t & operator[](size_t index) { - TT_ASSERT(index < rt_args_count, "Index specified is larger than runtime args size"); - return this->rt_args_data[index]; - } - inline const uint32_t& operator[](size_t index) const { - TT_ASSERT(index < rt_args_count, "Index specified is larger than runtime args size"); - return this->rt_args_data[index]; - } - inline uint32_t & at(size_t index) { - TT_FATAL(index < rt_args_count, "Index specified is larger than runtime args size"); - return this->rt_args_data[index]; - } - inline const uint32_t& at(size_t index) const { - TT_FATAL(index < rt_args_count, "Index specified is larger than runtime args size"); - return this->rt_args_data[index]; - } - inline uint32_t * data() noexcept { - return rt_args_data; - } - inline const uint32_t * data() const noexcept { - return rt_args_data; - } - inline size_t size() const noexcept{ - return rt_args_count; - } -}; + std::uint32_t * rt_args_data; + std::size_t rt_args_count; + + std::uint32_t & operator[](std::size_t index); + + const std::uint32_t& operator[](std::size_t index) const; + + std::uint32_t & at(std::size_t index); + const std::uint32_t& at(std::size_t index) const; + + std::uint32_t * data() noexcept; + + const std::uint32_t * data() const noexcept; + + std::size_t size() const noexcept; }; + +}