Skip to content

Commit

Permalink
refactor(cell): re-implement global to shared loader. (microsoft#32)
Browse files Browse the repository at this point in the history
* re-implement global to shared loader for row major layout.

* improve implementation.

* fix the implementation of storer for row-major layout.

* delete uncessary codes.

* bug fix for setup.py.

* update readme.

* build the dynamic library for specified CUDA architecture.
  • Loading branch information
lcy-seso authored Jan 15, 2025
1 parent b586a02 commit 5c9223c
Show file tree
Hide file tree
Showing 23 changed files with 664 additions and 1,325 deletions.
11 changes: 10 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ColumnLimit: 80
IndentWidth: 4
AccessModifierOffset: -2
DerivePointerAlignment: false
# If true, empty lines at the start of blocks are kept.
KeepEmptyLinesAtTheStartOfBlocks: false
SortIncludes: true
IncludeBlocks: Regroup
Expand All @@ -17,7 +18,15 @@ IncludeCategories:
Priority: 2
- Regex: '"([A-Za-z0-9.\Q/-_\E])+"'
Priority: 1

AllowShortLoopsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
Cpp11BracedListStyle: true
# If true, always break after the template<...> of a template declaration.
AlwaysBreakTemplateDeclarations: true
# If false, a function declaration's or function definition's parameters will
# either all be on the same line or will have one line each.
BinPackArguments: true
BreakConstructorInitializersBeforeComma: true
# The maximum number of consecutive empty lines to keep.
MaxEmptyLinesToKeep: 1
35 changes: 18 additions & 17 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"files.associations": {
"array": "cpp",
"string": "cpp",
"string_view": "cpp",
"span": "cpp",
"bitset": "cpp",
"initializer_list": "cpp",
"utility": "cpp",
"*.tcc": "cpp",
"chrono": "cpp",
"random": "cpp",
"limits": "cpp",
"semaphore": "cpp"
},
"gotoSymbolStack.currentStackPosition": 0,
"gotoSymbolStack.maxStackPosition": 0,
"gotoSymbolStack.filePositionInfo": []
"files.associations": {
"array": "cpp",
"string": "cpp",
"string_view": "cpp",
"span": "cpp",
"bitset": "cpp",
"initializer_list": "cpp",
"utility": "cpp",
"*.tcc": "cpp",
"chrono": "cpp",
"random": "cpp",
"limits": "cpp",
"semaphore": "cpp",
"regex": "cpp"
},
"gotoSymbolStack.currentStackPosition": 0,
"gotoSymbolStack.maxStackPosition": 0,
"gotoSymbolStack.filePositionInfo": []
}
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ include_directories(include)
add_subdirectory(src)
add_subdirectory(tests/cpp)

option(BUILD_EXAMPLES "Build TileFusion with examples" ON)
# FIXME(ying): temporarily disable the test to refactor the copy. Make sure all
# the unit tests pass after the refactor.
option(BUILD_EXAMPLES "Build TileFusion with examples" OFF)
if(BUILD_EXAMPLES)
set(EXAMPLES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/examples/cpp")
file(GLOB SUBDIRS "${EXAMPLES_DIR}/*")
Expand Down
16 changes: 7 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
EXAMPLE_DIR := examples
TEST_DIR := tests/python
UNIT_TEST ?= test_scatter_nd
CPP_UT ?= test_gemm
CPP_UTS := scripts/unittests/run_all_cpp_tests.sh

PY_EXAMPLE ?= $(EXAMPLE_DIR)/python/scatter_nd.py
UNIT ?= $(TEST_DIR)/$(UNIT_TEST).py
# TODO: Update this command as the Python example is outdated and
# not in sync with the latest changes in the master branch.
# PY_EXAMPLE ?= $(EXAMPLE_DIR)/python/scatter_nd.py

WITH_TEST ?= ON

Expand All @@ -20,11 +19,10 @@ build:

$(DYNAMIC_LIB): build

py_example: $(DYNAMIC_LIB)
@python3 $(PY_EXAMPLE)

unit_test: $(DYNAMIC_LIB)
@python3 $(UNIT)
# TODO: Update this command as the Python example is outdated and
# not in sync with the latest changes in the master branch.
# py_example: $(DYNAMIC_LIB)
# @python3 $(PY_EXAMPLE)

unit_test_cpp: $(DYNAMIC_LIB)
@cd $(BUILD_DIR) && ctest -R $(CPP_UT) -V
Expand Down
34 changes: 24 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,24 @@ TileFusion requires a C++20 host compiler, CUDA 12.0 or later, and GCC version 1

### Build from Source

#### Using Makefile
To build the project using the provided `Makefile`, simply run:
```bash
make
```
#### Building the C++ Library Using Makefile

1. To build the project using the provided `Makefile`, simply run:

```bash
make
```

2. Run the C++ unit tests:

- **Run a single C++ unit test**:
```bash
make unit_test_cpp CPP_UT=test_gemm
```
- **Run all C++ unit tests**:
```bash
make unit_test_cpps
```

#### Building the Python Wrapper

Expand All @@ -108,12 +121,13 @@ make
python3 setup.py clean
```

### Unit Test
3. Install the Python wrapper in editable mode (recommended for development):

```bash
python3 setup.py develop
```

- **Run a single unit test**: `make unit_test UNIT_TEST=test_scatter_nd.py`
- **Run all unit tests**: `./scripts/unittests/python.sh`
- **Run a single cpp unit test**: `make unit_test_cpp CPP_UT=test_copy`
- **Run all cpp unit tests**: `make unit_test_cpps`
This allows you to edit the source code directly without needing to reinstall it repeatedly.

## Contributing

Expand Down
19 changes: 0 additions & 19 deletions benchmarks/cpp/copy/CMakeLists.txt

This file was deleted.

32 changes: 0 additions & 32 deletions benchmarks/cpp/copy/README.md

This file was deleted.

87 changes: 0 additions & 87 deletions benchmarks/cpp/copy/cutlass_copy.cuh

This file was deleted.

Loading

0 comments on commit 5c9223c

Please sign in to comment.