Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting issues #9

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/check-spdx.yaml
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}
3 changes: 1 addition & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
# - name: 'Tar install directory and metal lib directory'
# shell: bash
# working-directory: ${{ steps.strings.outputs.install-output-dir }}
# run: |
# run: |
# tar cvf artifact.tar .

# - name: Upload install folder to archive
Expand Down Expand Up @@ -150,4 +150,3 @@ jobs:
export LD_LIBRARY_PATH="/opt/ttmlir-toolchain/lib/:${{ steps.strings.outputs.install-output-dir }}/lib:${LD_LIBRARY_PATH}"
source env/activate
pytest -v test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*.pyc

23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
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
1 change: 0 additions & 1 deletion env/activate
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ else
export TT_METAL_LOGGER_LEVEL="ERROR"

fi

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
torch-mlir
torch-mlir
torch@https://download.pytorch.org/whl/cpu-cxx11-abi/torch-2.5.0%2Bcpu.cxx11.abi-cp311-cp311-linux_x86_64.whl
torchvision
--extra-index-url https://download.pytorch.org/whl/nightly/cpu
Expand Down
39 changes: 24 additions & 15 deletions setup.py
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,
)
)
1 change: 1 addition & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pytest
import torch


@pytest.fixture(autouse=True)
def run_around_tests():
yield
Expand Down
Loading