Skip to content

Commit

Permalink
Remove core_config.h from host code inclusion in dev_msgs.h (#15584)
Browse files Browse the repository at this point in the history
  • Loading branch information
blozano-tt authored Dec 2, 2024
1 parent 070a226 commit f34d56b
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 40 deletions.
3 changes: 1 addition & 2 deletions tt_metal/hostdevcommon/dprint_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@

#pragma once

#include "core_config.h"

// DataFormat comes from tt_backend_api_types.hpp for SW, and tensix_types.h for HW...
// But wait there's more, SW also includes tensix_types.h so there's both tt::DataFormat and DataFormat there. Use a
// different name here so that this header can be included in both.
#if !defined(KERNEL_BUILD) && !defined(FW_BUILD) // SW
#include "common/tt_backend_api_types.hpp"
typedef tt::DataFormat CommonDataFormat;
#else // HW already includes tensix_types.h
#include "core_config.h"
typedef DataFormat CommonDataFormat;
#endif

Expand Down
10 changes: 0 additions & 10 deletions tt_metal/hw/inc/blackhole/core_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ enum ProgrammableCoreType {
COUNT = 3,
};

enum class AddressableCoreType : uint8_t {
TENSIX = 0,
ETH = 1,
PCIE = 2,
DRAM = 3,
HARVESTED = 4,
UNKNOWN = 5,
COUNT = 6,
};

enum class TensixProcessorTypes : uint8_t { DM0 = 0, DM1 = 1, MATH0 = 2, MATH1 = 3, MATH2 = 4, COUNT = 5 };

enum class EthProcessorTypes : uint8_t { DM0 = 0, DM1 = 1, COUNT = 2 };
Expand Down
22 changes: 18 additions & 4 deletions tt_metal/hw/inc/dev_msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#pragma once

#include "core_config.h"
#include "hostdevcommon/profiler_common.h"
#include "hostdevcommon/dprint_common.h"

Expand All @@ -21,6 +20,7 @@
// We don't want to pollute host code with those
// Including them here within the guard to make FW/KERNEL happy
// The right thing to do, would be "include what you use" in the other header files
#include "core_config.h"
#include "noc/noc_parameters.h"
#include "dev_mem_map.h"

Expand Down Expand Up @@ -97,16 +97,20 @@ struct rta_offset_t {
volatile uint16_t crta_offset;
};

// Maximums across all archs
constexpr auto NUM_PROGRAMMABLE_CORE_TYPES = 3u;
constexpr auto NUM_PROCESSORS_PER_CORE_TYPE = 5u;

struct kernel_config_msg_t {
volatile uint16_t watcher_kernel_ids[DISPATCH_CLASS_MAX];
volatile uint16_t ncrisc_kernel_size16; // size in 16 byte units

// Ring buffer of kernel configuration data
volatile uint32_t kernel_config_base[static_cast<int>(ProgrammableCoreType::COUNT)];
volatile uint16_t sem_offset[static_cast<int>(ProgrammableCoreType::COUNT)];
volatile uint32_t kernel_config_base[NUM_PROGRAMMABLE_CORE_TYPES];
volatile uint16_t sem_offset[NUM_PROGRAMMABLE_CORE_TYPES];
volatile uint16_t cb_offset;
rta_offset_t rta_offset[DISPATCH_CLASS_MAX];
volatile uint32_t kernel_text_offset[MaxProcessorsPerCoreType];
volatile uint32_t kernel_text_offset[NUM_PROCESSORS_PER_CORE_TYPE];

volatile uint16_t host_assigned_id;

Expand Down Expand Up @@ -277,6 +281,16 @@ struct profiler_msg_t {
uint32_t buffer[PROFILER_RISC_COUNT][kernel_profiler::PROFILER_L1_VECTOR_SIZE];
};

enum class AddressableCoreType : uint8_t {
TENSIX = 0,
ETH = 1,
PCIE = 2,
DRAM = 3,
HARVESTED = 4,
UNKNOWN = 5,
COUNT = 6,
};

struct addressable_core_t {
volatile uint8_t x, y;
volatile AddressableCoreType type;
Expand Down
10 changes: 0 additions & 10 deletions tt_metal/hw/inc/grayskull/core_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ enum ProgrammableCoreType {
COUNT = 3, // for now, easier to keep structures shared across arches' the same size
};

enum class AddressableCoreType : uint8_t {
TENSIX = 0,
ETH = 1, // TODO: Make this accessible through the HAL and remove non-GS entries
PCIE = 2,
DRAM = 3,
HARVESTED = 4,
UNKNOWN = 5,
COUNT = 6,
};

enum class TensixProcessorTypes : uint8_t { DM0 = 0, DM1 = 1, MATH0 = 2, MATH1 = 3, MATH2 = 4, COUNT = 5 };

constexpr uint8_t MaxProcessorsPerCoreType = 5;
Expand Down
10 changes: 0 additions & 10 deletions tt_metal/hw/inc/wormhole/core_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ enum ProgrammableCoreType {
COUNT = 3,
};

enum class AddressableCoreType : uint8_t {
TENSIX = 0,
ETH = 1,
PCIE = 2,
DRAM = 3,
HARVESTED = 4,
UNKNOWN = 5,
COUNT = 6,
};

enum class TensixProcessorTypes : uint8_t { DM0 = 0, DM1 = 1, MATH0 = 2, MATH1 = 3, MATH2 = 4, COUNT = 5 };

enum class EthProcessorTypes : uint8_t { DM0 = 0, COUNT = 1 };
Expand Down
2 changes: 1 addition & 1 deletion tt_metal/impl/program/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ KernelGroup::KernelGroup(
}
}

for (uint32_t index = 0; index < MaxProcessorsPerCoreType; index ++) {
for (uint32_t index = 0; index < NUM_PROCESSORS_PER_CORE_TYPE; index ++) {
this->kernel_bin_sizes[index] = 0;
this->kernel_text_offsets[index] = 0;
this->launch_msg.kernel_config.kernel_text_offset[index] = 0;
Expand Down
4 changes: 2 additions & 2 deletions tt_metal/impl/program/program.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ struct KernelGroup {
kernel_id_array_t kernel_ids;
uint32_t rta_sizes[DISPATCH_CLASS_MAX];
uint32_t total_rta_size;
uint32_t kernel_text_offsets[MaxProcessorsPerCoreType];
uint32_t kernel_bin_sizes[MaxProcessorsPerCoreType];
uint32_t kernel_text_offsets[NUM_PROCESSORS_PER_CORE_TYPE];
uint32_t kernel_bin_sizes[NUM_PROCESSORS_PER_CORE_TYPE];
launch_msg_t launch_msg;
go_msg_t go_msg;

Expand Down
1 change: 1 addition & 0 deletions tt_metal/llrt/blackhole/bh_hal_active_eth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <cstdint>
#include <vector>

#include "core_config.h"
#include "dev_msgs.h"
#include "eth_l1_address_map.h"

Expand Down
1 change: 1 addition & 0 deletions tt_metal/llrt/blackhole/bh_hal_idle_eth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <cstdint>
#include <vector>

#include "core_config.h"
#include "dev_mem_map.h"
#include "dev_msgs.h"
#include "noc/noc_parameters.h"
Expand Down
1 change: 1 addition & 0 deletions tt_metal/llrt/blackhole/bh_hal_tensix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <cstdint>
#include <vector>

#include "core_config.h"
#include "dev_mem_map.h"
#include "dev_msgs.h"
#include "noc/noc_parameters.h"
Expand Down
2 changes: 1 addition & 1 deletion tt_metal/llrt/grayskull/gs_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <numeric>
#include <vector>

#include "core_config.h" // ProgrammableCoreType
#include "core_config.h"
#include "dev_mem_map.h"
#include "dev_msgs.h"
#include "noc/noc_parameters.h"
Expand Down
1 change: 1 addition & 0 deletions tt_metal/llrt/wormhole/wh_hal_active_eth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <cstdint>

#include "core_config.h"
#include "dev_msgs.h"
#include "eth_l1_address_map.h"

Expand Down
1 change: 1 addition & 0 deletions tt_metal/llrt/wormhole/wh_hal_idle_eth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <cstdint>
#include <vector>

#include "core_config.h"
#include "dev_mem_map.h"
#include "dev_msgs.h"
#include "noc/noc_parameters.h"
Expand Down
1 change: 1 addition & 0 deletions tt_metal/llrt/wormhole/wh_hal_tensix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <numeric>
#include <vector>

#include "core_config.h"
#include "dev_mem_map.h"
#include "dev_msgs.h"
#include "noc/noc_parameters.h"
Expand Down

0 comments on commit f34d56b

Please sign in to comment.