-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added required files for pre-commit formatting. * Applied Tenstorrent formatting style.
- Loading branch information
1 parent
958c588
commit 6e5bd7b
Showing
19 changed files
with
511 additions
and
404 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
DEFAULT: | ||
perform_check: yes # Perform check for all files | ||
allowed_licenses: | ||
- Apache-2.0 | ||
license_for_new_files: Apache-2.0 # license to be used when inserting a new copyright notice | ||
new_notice_c: |+ # notice for new C, CPP, H, HPP and LD files | ||
// SPDX-FileCopyrightText: (c) {years} Tenstorrent AI ULC | ||
// | ||
// SPDX-License-Identifier: {license} | ||
new_notice_python: |+ # notice for new python files | ||
# SPDX-FileCopyrightText: (c) {years} Tenstorrent AI ULC | ||
# | ||
# SPDX-License-Identifier: {license} |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
*.pyc | ||
|
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,23 @@ | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 22.3.0 | ||
hooks: | ||
- id: black | ||
language_version: python3 | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v18.1.7 | ||
hooks: | ||
- id: clang-format | ||
types_or: [c++, c] | ||
args: [-style=file, -i] | ||
- repo: https://github.com/espressif/check-copyright/ | ||
rev: v1.0.3 | ||
hooks: | ||
- id: check-copyright | ||
args: ['--config', '.github/check-spdx.yaml'] | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-added-large-files |
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 |
---|---|---|
|
@@ -35,4 +35,3 @@ else | |
export TT_METAL_LOGGER_LEVEL="ERROR" | ||
|
||
fi | ||
|
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 |
---|---|---|
@@ -1,32 +1,41 @@ | ||
# SPDX-FileCopyrightText: (c) 2024 Tenstorrent AI ULC | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import os | ||
import sys | ||
import subprocess | ||
from setuptools import setup, Extension | ||
from setuptools.command.build_ext import build_ext | ||
|
||
|
||
class CMakeBuild(build_ext): | ||
def build_extension(self, ext): | ||
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name))) | ||
cfg = 'Debug' if self.debug else 'Release' | ||
cfg = "Debug" if self.debug else "Release" | ||
cmake_args = [ | ||
f'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}', | ||
f'-DPYTHON_EXECUTABLE={sys.executable}', | ||
f'-DCMAKE_BUILD_TYPE={cfg}', | ||
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}", | ||
f"-DPYTHON_EXECUTABLE={sys.executable}", | ||
f"-DCMAKE_BUILD_TYPE={cfg}", | ||
] | ||
build_args = ['--config', cfg] | ||
build_args = ["--config", cfg] | ||
|
||
if not os.path.exists(self.build_temp): | ||
os.makedirs(self.build_temp) | ||
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp) | ||
subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp) | ||
subprocess.check_call( | ||
["cmake", ext.sourcedir] + cmake_args, cwd=self.build_temp | ||
) | ||
subprocess.check_call( | ||
["cmake", "--build", "."] + build_args, cwd=self.build_temp | ||
) | ||
|
||
|
||
setup( | ||
name='tt_torch', | ||
version='0.1', | ||
author='Aleks Knezevic', | ||
description='TT PyTorch FrontEnd', | ||
long_description='', | ||
ext_modules=[Extension('c_bindings', sources=[])], | ||
cmdclass={'build_ext': CMakeBuild}, | ||
name="tt_torch", | ||
version="0.1", | ||
author="Aleks Knezevic", | ||
description="TT PyTorch FrontEnd", | ||
long_description="", | ||
ext_modules=[Extension("c_bindings", sources=[])], | ||
cmdclass={"build_ext": CMakeBuild}, | ||
zip_safe=False, | ||
) | ||
) |
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
import pytest | ||
import torch | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def run_around_tests(): | ||
yield | ||
|
Oops, something went wrong.