-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add infrastructure for testing julia's LLVM passes #21498
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ifeq ($(LLVM_DEBUG),1) | ||
LLVM_BUILDTYPE := Debug | ||
else | ||
LLVM_BUILDTYPE := Release | ||
endif | ||
LLVM_CMAKE_BUILDTYPE := $(LLVM_BUILDTYPE) | ||
ifeq ($(LLVM_ASSERTIONS),1) | ||
LLVM_BUILDTYPE := $(LLVM_BUILDTYPE)+Asserts | ||
endif | ||
LLVM_FLAVOR := $(LLVM_BUILDTYPE) | ||
ifeq ($(LLVM_SANITIZE),1) | ||
ifeq ($(SANITIZE_MEMORY),1) | ||
LLVM_BUILDTYPE := $(LLVM_BUILDTYPE)+MSAN | ||
else | ||
LLVM_BUILDTYPE := $(LLVM_BUILDTYPE)+ASAN | ||
endif | ||
endif | ||
|
||
LLVM_SRC_DIR:=$(SRCDIR)/srccache/llvm-$(LLVM_VER) | ||
LLVM_BUILD_DIR:=$(BUILDDIR)/llvm-$(LLVM_VER) | ||
LLVM_BUILDDIR_withtype := $(LLVM_BUILD_DIR)/build_$(LLVM_BUILDTYPE) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SRCDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) | ||
JULIAHOME := $(abspath $(SRCDIR)/../..) | ||
include $(JULIAHOME)/deps/Versions.make | ||
include $(JULIAHOME)/Make.inc | ||
include $(JULIAHOME)/deps/llvm-ver.make | ||
BUILDDIR = $(JULIAHOME)/deps/scratch | ||
include $(JULIAHOME)/deps/llvm-options.mk | ||
LLVM_SRC_DIR:=$(JULIAHOME)/deps/srccache/llvm-$(LLVM_VER) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These configuration options aren't really right, since they assume a very specific in-tree source build layout. Does LLVM not provide any way to run its test framework out-of-tree? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can build it out of tree, but you need a copy of lit which is in the LLVM source dir. You can probably make it work, but might be easier for somebody who uses out-of-tree builds to fix this up after committing this. |
||
test: | ||
PATH=$$PATH:$(LLVM_BUILDDIR_withtype)/bin $(LLVM_SRC_DIR)/utils/lit/lit.py -v . | ||
.PHONY: test |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import os | ||
import sys | ||
import re | ||
import platform | ||
|
||
import lit.util | ||
import lit.formats | ||
|
||
config.name = 'Julia' | ||
config.suffixes = ['.ll'] | ||
config.test_source_root = os.path.dirname(__file__) | ||
config.test_format = lit.formats.ShTest(False) | ||
|
||
path = os.path.pathsep.join((os.path.join(os.path.dirname(__file__),"../../usr/tools"), config.environment['PATH'])) | ||
config.environment['PATH'] = path |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
; RUN: opt -load libjulia.so -LowerSIMDLoop -S %s | FileCheck %s | ||
|
||
define void @simd_test(double *%a, double *%b) { | ||
top: | ||
br label %loop | ||
loop: | ||
%i = phi i64 [0, %top], [%nexti, %loop] | ||
%aptr = getelementptr double, double *%a, i64 %i | ||
%bptr = getelementptr double, double *%b, i64 %i | ||
; CHECK: llvm.mem.parallel_loop_access | ||
%aval = load double, double *%aptr | ||
%bval = load double, double *%aptr | ||
%cval = fadd double %aval, %bval | ||
store double %cval, double *%bptr | ||
%nexti = add i64 %i, 1, !simd_loop !1 | ||
%done = icmp sgt i64 %nexti, 500 | ||
br i1 %done, label %loopdone, label %loop | ||
loopdone: | ||
ret void | ||
} | ||
|
||
!1 = !{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need to be conditional on llvm version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like 3.8 was the first version with this option. However, I don't think CMake complains too loudly if you pass it an option it doesn't recognize.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.8 is the first version that we actually use CMAKE on so it should not be a problem, see #19054.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Keno this flag caused #21621 - why was this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so you can load libjulia into opt and use the llvm passes.