Skip to content
Open

m #50

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
60 changes: 30 additions & 30 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
---
BasedOnStyle: LLVM
IndentWidth: 4 # 缩进宽度,LLVM 默认值为 2,改为 4
AccessModifierOffset: -4 # public/protected/private 访问控制符相对成员的偏移,与 IndentWidth 配合,LLVM 默认值为 -2
AlignOperands: AlignAfterOperator # 双目运算符的行间对齐,LLVM 默认值为 Align,改为带符号一起换行
BreakBeforeBinaryOperators: All # 在双目运算符之前换行,LLVM 默认值为 None,改为换行时总是把双目运算符放在行首,包括赋值(=)
ColumnLimit: 0 # 列宽限制,LLVM 默认值为 80,改为不限制
AllowShortBlocksOnASingleLine: Always # 是否允许短块(单个语句的块)不换行,LLVM 默认值为 Never,改为允许
AllowShortLoopsOnASingleLine: true # 是否允许短循环不换行,LLVM 默认值为 false,改为允许
InsertBraces: true # 是否在 if/for/while/switch 等语句后插入大括号,LLVM 默认值为 false,改为允许
BreakBeforeBraces: Custom # 大括号换行配置,LLVM 默认值为 LLVM,改为自定义以使 BraceWrapping 生效
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
---
BasedOnStyle: LLVM
IndentWidth: 4 # 缩进宽度,LLVM 默认值为 2,改为 4
AccessModifierOffset: -4 # public/protected/private 访问控制符相对成员的偏移,与 IndentWidth 配合,LLVM 默认值为 -2
AlignOperands: AlignAfterOperator # 双目运算符的行间对齐,LLVM 默认值为 Align,改为带符号一起换行
BreakBeforeBinaryOperators: All # 在双目运算符之前换行,LLVM 默认值为 None,改为换行时总是把双目运算符放在行首,包括赋值(=)
ColumnLimit: 0 # 列宽限制,LLVM 默认值为 80,改为不限制
AllowShortBlocksOnASingleLine: Always # 是否允许短块(单个语句的块)不换行,LLVM 默认值为 Never,改为允许
AllowShortLoopsOnASingleLine: true # 是否允许短循环不换行,LLVM 默认值为 false,改为允许
InsertBraces: true # 是否在 if/for/while/switch 等语句后插入大括号,LLVM 默认值为 false,改为允许
BreakBeforeBraces: Custom # 大括号换行配置,LLVM 默认值为 LLVM,改为自定义以使 BraceWrapping 生效
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
120 changes: 60 additions & 60 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
name: Build and test
on:
pull_request:
push:
paths-ignore:
- '**.md'
- 'LICENSE'

jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
type: [release]
runs-on: ${{ matrix.os }}
steps:

- name: checkout code
uses: actions/checkout@v4

- name: install xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest

- name: Xmake Build & Install
run: |
xmake
xmake install

- name: Install Python
run: |
cd python
pip install .
cd ..

- name: Assignment-0
run: |
python test/test_runtime.py --device cpu

- name: Assignment-1
run: |
python test/test_tensor.py

- name: Assignment-2
run: |
python test/ops/add.py
python test/ops/argmax.py
python test/ops/embedding.py
python test/ops/linear.py
python test/ops/rms_norm.py
python test/ops/rope.py
python test/ops/self_attention.py
python test/ops/swiglu.py

- name: Assignment-3
run: |
python test/test_infer.py --test
name: Build and test
on:
pull_request:
push:
paths-ignore:
- '**.md'
- 'LICENSE'
jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
type: [release]
runs-on: ${{ matrix.os }}
steps:
- name: checkout code
uses: actions/checkout@v4
- name: install xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
- name: Xmake Build & Install
run: |
xmake
xmake install
- name: Install Python
run: |
cd python
pip install .
cd ..
- name: Assignment-0
run: |
python test/test_runtime.py --device cpu
- name: Assignment-1
run: |
python test/test_tensor.py
- name: Assignment-2
run: |
python test/ops/add.py
python test/ops/argmax.py
python test/ops/embedding.py
python test/ops/linear.py
python test/ops/rms_norm.py
python test/ops/rope.py
python test/ops/self_attention.py
python test/ops/swiglu.py
- name: Assignment-3
run: |
python test/test_infer.py --test
173 changes: 83 additions & 90 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,90 +1,83 @@
# Xmake cache
.xmake/
build/

# Binaries
bin/
lib/
*.so
*.dll
*.dylib
*.pyd

# MacOS Cache
.DS_Store

# Vscode
.vscode/

# Python
__pycache__/

# Log
*.log

# Cache
cache/

# JSON
*.json

#GGUF
*.gguf


# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
build/
dist/
*.egg-info/
.eggs/

# Virtual environments
.venv/
env/
venv/
ENV/
*.env
*.venv

# PyInstaller
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# MyPy and other type checking
.mypy_cache/
.dmypy.json
.pyre/

# Test and coverage
.coverage
htmlcov/
.tox/
.nox/
.cache/
.pytest_cache/

# Jupyter Notebook checkpoints
.ipynb_checkpoints

# IDE and editor settings
.vscode/
.idea/
*.swp
*~

# macOS
.DS_Store

# Windows
Thumbs.db
ehthumbs.db
desktop.ini
# Xmake cache
.xmake/
build/

# Binaries
bin/
lib/
*.so
*.dll
*.dylib
*.pyd

# MacOS Cache
.DS_Store

# Vscode
.vscode/

# Python
__pycache__/

# Log
*.log

# Cache
cache/

# 本地模型目录(体积大,勿提交)
DeepSeek-R1-Distill-Qwen-1___5B/

# JSON
*.json

#GGUF
*.gguf


# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
build/
dist/
*.egg-info/
.eggs/

# Virtual environments
.venv/
env/
venv/
ENV/
*.env
*.venv

# PyInstaller
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# MyPy and other type checking
.mypy_cache/
.dmypy.json
.pyre/

# Test and coverage
.coverage
htmlcov/
.tox/
.nox/
.cache/
.pytest_cache/

# Jupyter Notebook checkpoints
.ipynb_checkpoints

# 本地文档与图片(不随代码库同步;项目完成情况报告.md 需提交则不要写在这里)
docs/

11 changes: 11 additions & 0 deletions =42
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting setuptools
Downloading https://mirrors.aliyun.com/pypi/packages/e1/c6/76dc613121b793286a3f91621d7b75a2b493e0390ddca50f11993eadf192/setuptools-82.0.0-py3-none-any.whl (1.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 24.9 MB/s eta 0:00:00
Collecting wheel
Downloading https://mirrors.aliyun.com/pypi/packages/87/22/b76d483683216dde3d67cba61fb2444be8d5be289bf628c13fc0fd90e5f9/wheel-0.46.3-py3-none-any.whl (30 kB)
Collecting packaging>=24.0 (from wheel)
Downloading https://mirrors.aliyun.com/pypi/packages/b7/b9/c538f279a4e237a006a2c98387d081e9eb060d203d8ed34467cc0f0b9b53/packaging-26.0-py3-none-any.whl (74 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 74.4/74.4 kB 23.6 MB/s eta 0:00:00
Installing collected packages: setuptools, packaging, wheel
Successfully installed packaging-26.0 setuptools-82.0.0 wheel-0.46.3
Comment on lines +1 to +11
16 changes: 8 additions & 8 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
The MIT License (MIT)
Copyright © 2025 InfiniTensor

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The MIT License (MIT)
Copyright © 2025 InfiniTensor
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading
Loading