Skip to content

Commit

Permalink
#6819: Add support for CreateKernel absolute file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
tt-dma committed Apr 1, 2024
1 parent 49a9751 commit e8bb935
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tt_metal/host_api.hpp
Expand Up @@ -95,7 +95,7 @@ Program CreateProgram();
* | Argument | Description | Type | Valid Range | Required |
* |--------------|--------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|-------------|----------|
* | program | The program to which this kernel will be added to | Program & | | Yes |
* | file_name | Path to kernel src | const std::string & | | Yes |
* | file_name | Path to kernel src. Assumed to be absolute path, but will fall back to relative path from TT_METAL_HOME if file doesn't exist. | const std::string & | | Yes |
* | core_spec | Either a single logical core, a range of logical cores or a set of logical core ranges that indicate which cores kernel is placed on | const std::variant<CoreCoord, CoreRange, CoreRangeSet> & | | Yes |
* | config | Config for data movement or compute kernel | const std::variant<DataMovementConfig,ComputeConfig,EthernetConfig> & | | No |
*/
Expand Down
4 changes: 3 additions & 1 deletion tt_metal/jit_build/build.cpp
Expand Up @@ -417,8 +417,10 @@ void JitBuildState::copy_kernel(const string& kernel_in_path, const string& op_o
{
// TODO(pgk): get rid of this copy, compile kernel file in place as its own .o
const string out_dir = this->out_path_ + op_out_path + this->target_name_;
const string src = env_.get_root_path() + kernel_in_path;
const string dst = out_dir + "/kernel.cpp";
// Assume kernel_in_path is absolute and test if it exists, if it doesn't exist then assume
// it's relative to TT_METAL_HOME.
const string src = fs::exists(kernel_in_path) ? kernel_in_path : env_.get_root_path() + kernel_in_path;
fs::copy(src, dst, fs::copy_options::overwrite_existing);
}

Expand Down

0 comments on commit e8bb935

Please sign in to comment.