Skip to content

Instantly share code, notes, and snippets.

View ArchRobison's full-sized avatar

Arch D. Robison ArchRobison

  • Nvidia
  • Champaign, IL
View GitHub Profile
@ArchRobison
ArchRobison / gist:6943072
Created October 11, 2013 22:36
Fragment of julia/deps/llvm-3.3/tools/lli.cpp relevant to enabling Intel VTune Amplifier.
// The following functions have no effect if their respective profiling
// support wasn't enabled in the build configuration.
EE->RegisterJITEventListener(
JITEventListener::createOProfileJITEventListener());
EE->RegisterJITEventListener(
JITEventListener::createIntelJITEventListener());
@ArchRobison
ArchRobison / gist:7044371
Created October 18, 2013 16:51
Diff to make Julia compile with "llvm-project - Revision 192983: /llvm/trunk" (https://llvm.org/svn/llvm-project/llvm/trunk/ on 2013-10-18)
diff --git a/src/disasm.cpp b/src/disasm.cpp
index 3dec882..cd67f06 100644
--- a/src/disasm.cpp
+++ b/src/disasm.cpp
@@ -132,7 +132,11 @@ void jl_dump_function_asm(void* Fptr, size_t Fsize,
MCAsmBackend *MAB = 0;
if (ShowEncoding) {
CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx);
+#ifdef LLVM34
+ MAB = TheTarget->createMCAsmBackend(*MRI,TripleName, MCPU);
@ArchRobison
ArchRobison / gist:7085135
Created October 21, 2013 14:48
Increases in text and data size caused by compiling Julia with LLVM flag --with--intel-jitevents turned on *and* LLVM flag --disable-threads turnd off. Baseline is with those two flags set differently.
Fiilename Increase of Increase of
Text Size Data Size
bugpoint 0.0176% 0.2122%
dnsimp 0.0000% 0.0000%
fftwf-wisdom 0.0000% 0.0000%
fftw-wisdom 0.0000% 0.0000%
julia-basic 0.0000% 0.0000%
julia-readline 0.0000% 0.0000%
llc 0.0707% 0.3236%
lli 0.2947% 0.6276%
LINK usr/lib/libjulia.so
PERL base/pcre_h.jl
PERL base/errno_h.jl
PERL base/build_h.jl.phony
PERL base/fenv_constants.jl
PERL base/file_constants.jl
PERL base/uv_constants.jl
CC ui/repl.o
CC ui/repl-readline.o
LINK usr/bin/julia-readline
@ArchRobison
ArchRobison / gist:7356843
Created November 7, 2013 15:50
Patch for fixing zlib linking problem in Julia.
--- a/ui/Makefile
+++ b/ui/Makefile
@@ -55,14 +55,14 @@ julia-readline: $(BUILD)/bin/julia-readline$(EXE)
julia-debug-readline: $(BUILD)/bin/julia-debug-readline$(EXE)
$(BUILD)/bin/julia-basic$(EXE): repl.o repl-basic.o
- @$(call PRINT_LINK, $(CXX) $(LINK_FLAGS) $(SHIPFLAGS) $^ -o $@ -L$(BUILD)/$(JL_PRIVATE_LIBDIR) -L$(BUILD)/$(JL_LIBDIR) $(JLDFLAGS) -ljulia)
+ @$(call PRINT_LINK, $(CXX) $(LINK_FLAGS) $(SHIPFLAGS) $^ -o $@ -L$(BUILD)/$(JL_PRIVATE_LIBDIR) -L$(BUILD)/$(JL_LIBDIR) -ljulia $(JLDFLAGS))
$(BUILD)/bin/julia-debug-basic$(EXE): repl.do repl-basic.do
- @$(call PRINT_LINK, $(CXX) $(LINK_FLAGS) $(DEBUGFLAGS) $^ -o $@ -L$(BUILD)/$(JL_PRIVATE_LIBDIR) -L$(BUILD)/$(JL_LIBDIR) $(JLDFLAGS) -ljulia-debug)
@ArchRobison
ArchRobison / gist:9145036
Created February 21, 2014 22:36
Sample sessions with experimental Julia with SLPVectorizer enabled.
julia> function foo( a::NTuple{4,Float32}, b::NTuple{4,Float32} )
(a[1]+b[1],a[2]+b[2],a[3]+b[3],a[4]+b[4])
end
foo (generic function with 1 method)
julia> t = NTuple{4,Float32}
(Float32,Float32,Float32,Float32)
julia> code_llvm(foo,(t,t))
@ArchRobison
ArchRobison / gist:9231536
Created February 26, 2014 15:25
Simple benchmark for https://github.com/JuliaLang/julia/pull/5355 . Try ```flog(1000, 1000000, 125000)```. With PR5355, it should also vectorize without ```@simd```.
function saxpy( a, x, y )
@simd for i=1:length(x)
@inbounds y[i] = y[i]+a*x[i]
end
end
function flog( n, reps, tolerance )
x = rand(Float32,n)
y = rand(Float32,n)
z = copy(y)
@ArchRobison
ArchRobison / gist:9231763
Created February 26, 2014 15:35
This benchmark requires https://github.com/JuliaLang/julia/pull/5355 and building Julia with LLVM 3.4. Try flog(1000,1000,500).
function sweep( irange, jrange, U, Vx, Vy, A, B )
for j in jrange
@simd for i in irange
@inbounds begin
u = U[i,j]
Vx[i,j] += (A[i,j+1]+A[i,j])*(U[i,j+1]-u)
Vy[i,j] += (A[i+1,j]+A[i,j])*(U[i+1,j]-u)
U [i,j] = u + B[i,j]*((Vx[i,j]-Vx[i,j-1]) + (Vy[i,j]-Vy[i-1,j]))
end
end
@ArchRobison
ArchRobison / gist:9232051
Created February 26, 2014 15:47
This benchmark requires https://github.com/JuliaLang/julia/pull/5355. Try flog(1000,1000000,30)
function inner( x, y )
s = zero(eltype(x))
@simd for i=1:length(x)
@inbounds s += x[i]*y[i]
end
s
end
function flog( n, reps, tolerance )
x = rand(Float32,n)
@ArchRobison
ArchRobison / gist:9793916
Last active August 29, 2015 13:57
Julia tuple math example without SLPVectorizer
$ cat foo.jl
function add( a::NTuple{4,Float32}, b::NTuple{4,Float32} )
(a[1]+b[1],a[2]+b[2],a[3]+b[3],a[4]+b[4])
end
function mul( a::NTuple{4,Float32}, b::NTuple{4,Float32} )
(a[1]*b[1],a[2]*b[2],a[3]*b[3],a[4]*b[4])
end
function madd( a::NTuple{4,Float32}, b::NTuple{4,Float32}, c::NTuple{4,Float32} )