[Triton-MLIR] add GitHub CI runners (#655)

This PR is to add GitHub Actions runners to the CI for better coverage.
This commit is contained in:
Shintaro Iwasaki
2022-09-14 23:09:56 -07:00
committed by GitHub
parent c14dff2190
commit 297d27e1c8
4 changed files with 38 additions and 7 deletions

View File

@@ -4,13 +4,33 @@ on:
workflow_dispatch: workflow_dispatch:
pull_request: pull_request:
branches: branches:
- main
- triton-mlir - triton-mlir
jobs: jobs:
Integration-Tests: Runner-Preparation:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Prepare runner matrix
id: set-matrix
run: |
if [ x"${{ github.repository }}" == x"openai/triton" ]; then
echo '::set-output name=matrix::[["self-hosted", "A10"], "macos-latest"]'
else
echo '::set-output name=matrix::["ubuntu-latest", "macos-latest"]'
fi
runs-on: [self-hosted, A10] Integration-Tests:
needs: Runner-Preparation
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: ${{fromJson(needs.Runner-Preparation.outputs.matrix)}}
steps: steps:
@@ -19,26 +39,29 @@ jobs:
- name: Clear cache - name: Clear cache
run: | run: |
rm -r ~/.triton/cache/ rm -rf ~/.triton/cache/
continue-on-error: true
- name: Check imports - name: Check imports
if: ${{ matrix.runner != 'macos-latest' }}
run: | run: |
pip install isort pip install isort
isort -c ./python || ( echo '::error title=Imports not sorted::Please run \"isort ./python\"' ; exit 1 ) isort -c ./python || ( echo '::error title=Imports not sorted::Please run \"isort ./python\"' ; exit 1 )
- name: Check python style - name: Check python style
if: ${{ matrix.runner != 'macos-latest' }}
run: | run: |
pip install autopep8 pip install autopep8
autopep8 -a -r -d --exit-code ./python || ( echo '::error title=Style issues::Please run \"autopep8 -a -r -i ./python\"' ; exit 1 ) autopep8 -a -r -d --exit-code ./python || ( echo '::error title=Style issues::Please run \"autopep8 -a -r -i ./python\"' ; exit 1 )
- name: Check cpp style - name: Check cpp style
if: ${{ matrix.runner != 'macos-latest' }}
run: | run: |
sudo apt-get install -y clang-format sudo apt-get install -y clang-format
find . -regex '.*\.\(cpp\|hpp\|h\|cc\)' -not -path "./python/build/*" -not -path "./include/triton/external/*" -print0 | xargs -0 -n1 clang-format -style=file --dry-run -Werror -i || find . -regex '.*\.\(cpp\|hpp\|h\|cc\)' -not -path "./python/build/*" -not -path "./include/triton/external/*" -print0 | xargs -0 -n1 clang-format -style=file --dry-run -Werror -i ||
(echo '::error title=Style issues:: Please run `find . -regex ".*\.\(cpp\|hpp\|h\|cc\)" -not -path "./python/build/*" -not -path "./include/triton/external/*" -print0 | xargs -0 -n1 clang-format -style=file -i`' ; exit 1) (echo '::error title=Style issues:: Please run `find . -regex ".*\.\(cpp\|hpp\|h\|cc\)" -not -path "./python/build/*" -not -path "./include/triton/external/*" -print0 | xargs -0 -n1 clang-format -style=file -i`' ; exit 1)
- name: Flake8 - name: Flake8
if: ${{ matrix.runner != 'macos-latest' }}
run: | run: |
pip install flake8 pip install flake8
flake8 --config ./python/setup.cfg ./python || ( echo '::error::Flake8 failed; see logs for errors.' ; exit 1 ) flake8 --config ./python/setup.cfg ./python || ( echo '::error::Flake8 failed; see logs for errors.' ; exit 1 )
@@ -59,6 +82,7 @@ jobs:
lit -v "$LIT_TEST_DIR" lit -v "$LIT_TEST_DIR"
- name: Run python tests - name: Run python tests
if: ${{ matrix.runner[0] == 'self-hosted' }}
run: | run: |
cd python/tests cd python/tests
pytest pytest

View File

@@ -123,7 +123,7 @@ struct PTXBuilder {
Operand *newAddrOperand(mlir::Value addr, StringRef constraint, int off = 0); Operand *newAddrOperand(mlir::Value addr, StringRef constraint, int off = 0);
llvm::SmallVector<Operand *> getAllArgs() const; llvm::SmallVector<Operand *, 4> getAllArgs() const;
llvm::SmallVector<Value, 4> getAllMLIRArgs() const; llvm::SmallVector<Value, 4> getAllMLIRArgs() const;

View File

@@ -48,8 +48,15 @@ protected:
initializer(); initializer();
if (cache == nullptr) { if (cache == nullptr) {
cache = dlsym(lib_h, name); cache = dlsym(lib_h, name);
if (cache == 0) if (cache == 0) {
#ifdef __EXCEPTIONS
throw std::runtime_error("dlsym unable to load function"); throw std::runtime_error("dlsym unable to load function");
#else
std::cerr << "Triton: dlsym unable to load function `" << name << "`"
<< std::endl;
std::abort();
#endif
}
} }
FunPtrT fptr; FunPtrT fptr;
*reinterpret_cast<void **>(&fptr) = cache; *reinterpret_cast<void **>(&fptr) = cache;

View File

@@ -66,7 +66,7 @@ llvm::SmallVector<Value, 4> PTXBuilder::getAllMLIRArgs() const {
return res; return res;
} }
SmallVector<PTXBuilder::Operand *> PTXBuilder::getAllArgs() const { SmallVector<PTXBuilder::Operand *, 4> PTXBuilder::getAllArgs() const {
llvm::SmallVector<Operand *, 4> res; llvm::SmallVector<Operand *, 4> res;
for (auto &x : argArchive) for (auto &x : argArchive)
if (!x->isList()) if (!x->isList())