-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Issue Related to #417 ### Description Introduction into TLB manager class. This class should hold maps between tlb indexes and cores, and should hand out tlb_indicies. This might not be completelly true after this PR, which was more focused on getting things out from cluster.cpp file. But not too much stuff. ### List of the changes - Created TLBManager class which lives inside TTDevice - Added get_tlb_manager to TTDevice - Moved dynamic_tlb_configs and dynamic_tlb_config_ordering maps. - Moved configure_tlb main logic with maps that hold these mapped tlbs - Moved all related functions from cluster.cpp - These moved maps/functions are still used throughout cluster.cpp, but this will be refactored further, so that the tlbmanager itself checks and hands out the writer. ### Testing Existing CI tests should cover this class. Will try to add additional TLBManager focused tests. ### API Changes There are no API changes in this PR.
- Loading branch information
Showing
16 changed files
with
356 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* SPDX-FileCopyrightText: (c) 2024 Tenstorrent Inc. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
#pragma once | ||
|
||
#include <unordered_map> | ||
|
||
#include "umd/device/tt_xy_pair.h" | ||
#include "umd/device/types/tlb.h" | ||
|
||
namespace tt { | ||
class Writer; | ||
} | ||
|
||
namespace tt::umd { | ||
|
||
class TTDevice; | ||
|
||
class TLBManager { | ||
public: | ||
TLBManager(TTDevice* tt_device); | ||
|
||
// TODO: Think about proper API which doesn't accept two cores. | ||
// core should be in VIRTUAL coords, and translated_core should be in TRANSLATED coords. | ||
void configure_tlb( | ||
tt_xy_pair core, tt_xy_pair translated_core, int32_t tlb_index, uint64_t address, uint64_t ordering); | ||
|
||
void set_dynamic_tlb_config(std::string fallback_tlb_name, int32_t tlb_index); | ||
void set_dynamic_tlb_config_ordering(std::string fallback_tlb_name, uint64_t ordering); | ||
|
||
bool address_in_tlb_space(uint64_t address, uint32_t size_in_bytes, int32_t tlb_index, uint64_t tlb_size); | ||
bool is_tlb_mapped(tt_xy_pair core); | ||
bool is_tlb_mapped(tt_xy_pair core, uint64_t address, uint32_t size_in_bytes); | ||
|
||
tt::Writer get_static_tlb_writer(tt_xy_pair core); | ||
tlb_configuration get_tlb_configuration(tt_xy_pair core); | ||
|
||
// TODO: the following members will be moved to private once enough stuff is moved out of cluster. | ||
std::unordered_map<int32_t, uint64_t> tlb_config_map_; | ||
std::unordered_map<tt_xy_pair, std::int32_t> map_core_to_tlb_; | ||
|
||
std::unordered_map<std::string, std::int32_t> dynamic_tlb_config_; | ||
std::unordered_map<std::string, uint64_t> dynamic_tlb_ordering_modes_; | ||
|
||
private: | ||
TTDevice* tt_device_; | ||
}; | ||
|
||
} // namespace tt::umd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.