code: started finalising transpilation process and preparing for performance testing and tuning
Some checks failed
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.10) (push) Has been cancelled
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.6) (push) Has been cancelled
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, pre) (push) Has been cancelled

This commit is contained in:
2025-03-23 13:38:22 +01:00
parent db02e9f90f
commit baa37ea183
11 changed files with 149 additions and 60 deletions

View File

@ -1,6 +1,7 @@
using CUDA
using .ExpressionProcessing
using .Interpreter
using .Utils
expressions = Vector{Expr}(undef, 2)
variables = Matrix{Float32}(undef, 2,2)
@ -35,7 +36,7 @@ end
reference[2,2] = 0.0
# reference = Matrix([5.0, NaN],
# [5.0, 0.0])
result = Interpreter.convert_to_matrix(parameters, NaN32)
result = Utils.convert_to_matrix(parameters, NaN32)
@test isequal(result, reference)
end

View File

@ -28,6 +28,7 @@ parameters[2][2] = 0.0
# generatedCode = Transpiler.transpile(postfixExpr)
generatedCode = Transpiler.transpile(postfixExprs[3], 2, 3) # TEMP
# println(generatedCode)
# CUDA.@sync interpret(postfixExprs, variables, parameters)
# This is just here for testing. This will be called inside the execute method in the Transpiler module
@ -40,4 +41,12 @@ parameters[2][2] = 0.0
func = CuFunction(mod, "ExpressionProcessing")
end
@testset "Test transpiler evaluation" begin
postfixExprs = Vector{ExpressionProcessing.PostfixType}()
push!(postfixExprs, expr_to_postfix(expressions[1]))
push!(postfixExprs, expr_to_postfix(expressions[2]))
@time Transpiler.evaluate(postfixExprs, variables, parameters)
end
#TODO: test performance of transpiler PTX generation when doing "return String(take!(buffer))" vs "return take!(buffer)"

View File

@ -2,17 +2,33 @@ using ExpressionExecutorCuda
using Test
const baseFolder = dirname(dirname(pathof(ExpressionExecutorCuda)))
include(joinpath(baseFolder, "src", "Utils.jl"))
include(joinpath(baseFolder, "src", "ExpressionProcessing.jl"))
include(joinpath(baseFolder, "src", "Interpreter.jl"))
include(joinpath(baseFolder, "src", "Transpiler.jl"))
@testset "ExpressionExecutorCuda.jl" begin
include("ExpressionProcessingTests.jl")
include("InterpreterTests.jl")
# include("ExpressionProcessingTests.jl")
# include("InterpreterTests.jl")
include("TranspilerTests.jl")
end
@testset "CPU Interpreter" begin
include("CpuInterpreterTests.jl")
#@testset "CPU Interpreter" begin
# include("CpuInterpreterTests.jl")
#end
@testset "Performance tests" begin
# TODO: make performance tests
# Put data in shared memory:
# https://cuda.juliagpu.org/v2.6/api/kernel/#Shared-memory
# Make array const:
# https://cuda.juliagpu.org/v2.6/api/kernel/#Device-arrays
# Memory management like in C++ might help with performance improvements
# https://cuda.juliagpu.org/v2.6/lib/driver/#Memory-Management
end