Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ jobs:
cd build
ls ../mlir-build/lib/cmake/clang
cmake ../src/ -GNinja -DMLIR_DIR=`pwd`/../mlir-build/lib/cmake/mlir -DLLVM_EXTERNAL_LIT=`pwd`/../mlir-build/bin/llvm-lit -DClang_DIR=`pwd`/../mlir-build/lib/cmake/clang -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_C_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_COMPILER=${{matrix.cxxcompiler}}
- name: test mlir-clang
- name: test cgeist
run: |
cd build
ninja check-polygeist-opt
ninja check-mlir-clang
ninja check-cgeist
2 changes: 1 addition & 1 deletion .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
fetch-depth: 1
- uses: DoozyX/clang-format-lint-action@v0.11
with:
exclude: './tools/mlir-clang/Test ./test'
exclude: './tools/cgeist/Test ./test'
clangFormatVersion: 11
style: llvm
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

### 0. Clone Polygeist
```sh
git clone --recursive https://github.com/wsmoses/Polygeist.git
git clone --recursive https://github.com/llvm/Polygeist
cd Polygeist
```

Expand Down Expand Up @@ -41,7 +41,7 @@ cmake -G Ninja .. \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_BUILD_TYPE=DEBUG
ninja
ninja check-mlir-clang
ninja check-cgeist
```

#### Option 2: Using unified LLVM, MLIR, Clang, and Polygeist build
Expand All @@ -60,5 +60,5 @@ cmake -G Ninja ../llvm-project/llvm \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_BUILD_TYPE=DEBUG
ninja
ninja check-mlir-clang
ninja check-cgeist
```
2 changes: 1 addition & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
add_subdirectory(polygeist-opt)
add_subdirectory(mlir-clang)
add_subdirectory(cgeist)
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions tools/mlir-clang/CMakeLists.txt → tools/cgeist/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ set( LLVM_LINK_COMPONENTS
Vectorize
)

add_clang_executable(mlir-clang
mlir-clang.cc
add_clang_executable(cgeist
driver.cc
Lib/CGStmt.cc
"${LLVM_SOURCE_DIR}/../clang/tools/driver/cc1_main.cpp"
"${LLVM_SOURCE_DIR}/../clang/tools/driver/cc1as_main.cpp"
Expand All @@ -31,18 +31,18 @@ add_clang_executable(mlir-clang
Lib/TypeUtils.cc
Lib/CGCall.cc
)
install(TARGETS mlir-clang
install(TARGETS cgeist
EXPORT PolygeistTargets
RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}
COMPONENT mlir-clang)
COMPONENT cgeist)

target_include_directories(mlir-clang PRIVATE
target_include_directories(cgeist PRIVATE
"${LLVM_SOURCE_DIR}/../clang/include"
"${CMAKE_BINARY_DIR}/tools/clang/include"
)

target_compile_definitions(mlir-clang PUBLIC -DLLVM_OBJ_ROOT="${LLVM_BINARY_DIR}")
target_link_libraries(mlir-clang PRIVATE
target_compile_definitions(cgeist PUBLIC -DLLVM_OBJ_ROOT="${LLVM_BINARY_DIR}")
target_link_libraries(cgeist PRIVATE
MLIRSCFTransforms
MLIRPolygeist

Expand Down Expand Up @@ -75,5 +75,5 @@ target_link_libraries(mlir-clang PRIVATE
clangLex
clangSerialization
)
add_dependencies(mlir-clang MLIRPolygeistOpsIncGen MLIRPolygeistPassIncGen)
add_dependencies(cgeist MLIRPolygeistOpsIncGen MLIRPolygeistPassIncGen)
add_subdirectory(Test)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ configure_lit_site_cfg(
list(APPEND MLIR_CLANG_TEST_DEPS
llvm-config
FileCheck count not
mlir-clang
cgeist
split-file
clang
)

add_lit_testsuite(check-mlir-clang "Running the clang-to-mlir regression tests"
add_lit_testsuite(check-cgeist "Running the clang-to-mlir regression tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${MLIR_CLANG_TEST_DEPS}
)

add_lit_testsuite(check-mlir-clang-single "Running the clang-to-mlir regression tests"
add_lit_testsuite(check-cgeist-single "Running the clang-to-mlir regression tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${MLIR_CLANG_TEST_DEPS}
ARGS -j 1
)

set_target_properties(check-mlir-clang PROPERTIES FOLDER "clang-to-mlir tests")
set_target_properties(check-cgeist PROPERTIES FOLDER "clang-to-mlir tests")
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=okernel_2mm -S | FileCheck %s
// RUN: cgeist %s --function=okernel_2mm -S | FileCheck %s

void okernel_2mm(unsigned int ni,
double *tmp) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang -std=c++11 %s --function=* -S | FileCheck %s
// RUN: cgeist -std=c++11 %s --function=* -S | FileCheck %s

struct Meta {
float* f;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

struct AIntDivider {
AIntDivider() : divisor(3) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

struct AIntDivider {
AIntDivider() : divisor(3) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

struct AIntDivider {
AIntDivider() : divisor(3) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* --struct-abi=0 -memref-abi=0 -S | FileCheck %s
// RUN: cgeist %s --function=* --struct-abi=0 -memref-abi=0 -S | FileCheck %s

void run0(void*);
void run1(void*);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

class M {
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

class M {
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

struct AOperandInfo {
void* data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: mlir-clang %s --function=* -S -memref-fullrank | FileCheck %s --check-prefix=FULLRANK
// RUN: cgeist %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S -memref-fullrank | FileCheck %s --check-prefix=FULLRANK

void sub0(int a[2]);
void sub(int a[2]) { a[2]++; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

void* calloc(unsigned long a, unsigned long b);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

extern "C" {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=foo -S | FileCheck %s
// RUN: cgeist %s --function=foo -S | FileCheck %s

extern "C" {
int foo(char t) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

#include <utility>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

extern int& moo;
void oadd(int& x) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

// TODO handle negation on if combine
// TODO remove unused cyclic phi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s %stdinclude --function=set -S | FileCheck %s
// RUN: cgeist %s %stdinclude --function=set -S | FileCheck %s

#include <stdio.h>
#include <unistd.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s %stdinclude --function=set -S | FileCheck %s
// RUN: cgeist %s %stdinclude --function=set -S | FileCheck %s

#include <stdio.h>
#include <unistd.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

class D {
double a;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s
constexpr int num = 10 + 4;

int sum(int*);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

int get();
void other();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s
// XFAIL: *
#include <iostream>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --cuda-gpu-arch=sm_60 -nocudalib -nocudainc %resourcedir --function=* -S | FileCheck %s
// RUN: cgeist %s --cuda-gpu-arch=sm_60 -nocudalib -nocudainc %resourcedir --function=* -S | FileCheck %s

#include "Inputs/cuda.h"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=kernel_deriche -S | FileCheck %s
// RUN: cgeist %s --function=kernel_deriche -S | FileCheck %s

float kernel_deriche() {
float a2, a6;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=kernel_deriche -S | FileCheck %s
// RUN: cgeist %s --function=kernel_deriche -S | FileCheck %s

int deref(int a);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

struct A {
int x;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=create_matrix -S | FileCheck %s
// RUN: cgeist %s --function=create_matrix -S | FileCheck %s

void create_matrix(float *m, int size) {
float coe[2 * size + 1];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

int c2i(char x) {
return x;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

typedef size_t size_t_vec __attribute__((ext_vector_type(3)));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

void free(void*);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

#include <stdlib.h>
struct band {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s %stdinclude --function=alloc -S | FileCheck %s
// RUN: cgeist %s %stdinclude --function=alloc -S | FileCheck %s

#include <stdio.h>
#include <stdlib.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: mlir-clang %s %stdinclude -S | FileCheck %s
// RUN: mlir-clang %s %stdinclude -S -memref-fullrank | FileCheck %s --check-prefix=FULLRANK
// RUN: cgeist %s %stdinclude -S | FileCheck %s
// RUN: cgeist %s %stdinclude -S -memref-fullrank | FileCheck %s --check-prefix=FULLRANK

#include <stdio.h>
#include <unistd.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: mlir-clang %s %stdinclude -S | FileCheck %s
// RUN: mlir-clang %s %stdinclude -S -memref-fullrank | FileCheck %s --check-prefix=FULLRANK
// RUN: cgeist %s %stdinclude -S | FileCheck %s
// RUN: cgeist %s %stdinclude -S -memref-fullrank | FileCheck %s --check-prefix=FULLRANK

#include <stdio.h>
#include <unistd.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=gcd -S | FileCheck %s
// RUN: cgeist %s --function=gcd -S | FileCheck %s

int gcd(int m, int n) {
while (n > 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s %stdinclude --function=alloc -S | FileCheck %s
// RUN: cgeist %s %stdinclude --function=alloc -S | FileCheck %s

#include <time.h>
#include <sys/time.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=kernel_deriche -S | FileCheck %s
// RUN: cgeist %s --function=kernel_deriche -S | FileCheck %s

int local;
int local_init = 4;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

void histo_kernel(int i);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

struct MOperandInfo {
char device;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

struct MOperandInfo {
char device;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: mlir-clang %s --function=kernel_deriche -S | FileCheck %s
// RUN: mlir-clang %s --function=kernel_deriche -S -memref-fullrank | FileCheck %s --check-prefix=FULLRANK
// RUN: cgeist %s --function=kernel_deriche -S | FileCheck %s
// RUN: cgeist %s --function=kernel_deriche -S -memref-fullrank | FileCheck %s --check-prefix=FULLRANK

int kernel_deriche(int a[30][40]) {
a[3][5]++;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

int fir (int d_i[1000], int idx[1000] ) {
int i;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=kernel_deriche -S | FileCheck %s
// RUN: cgeist %s --function=kernel_deriche -S | FileCheck %s

int kernel_deriche(int *a) {
a[3]++;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=* -S | FileCheck %s
// RUN: cgeist %s --function=* -S | FileCheck %s

int MAX_DIMS;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s --function=test -S | FileCheck %s
// RUN: cgeist %s --function=test -S | FileCheck %s

// TODO
// XFAIL: *
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-clang %s -S | FileCheck %s
// RUN: cgeist %s -S | FileCheck %s

#pragma lower_to(copy_op, "memref.copy") "input"(a), "output"(b)
void copy_op(int b[3][3], int a[3][3]) {
Expand Down
Loading