nevermind, improved register management worked
Some checks are pending
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.10) (push) Waiting to run
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.6) (push) Waiting to run
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, pre) (push) Waiting to run

This commit is contained in:
Daniel 2024-12-07 10:23:04 +01:00
parent 1e7f6e9010
commit 203900bb26

View File

@ -100,32 +100,6 @@ end
# Note: Maybe make an additional function that transpiles and executed the code. This would then be the function the user calls
#
# TODO: I guess I need to move this to different module because it seems like I can't access inner functions
let registers = Dict() # stores the count of the register already used.
global get_next_free_register
global get_used_registers
# By convention these names correspond to the following types:
# - p -> pred
# - f32 -> float32
# - b32 -> 32 bit
# - var -> float32
# - param -> float32 !! although, they might get inserted as fixed number and not be sent to gpu?
function get_next_free_register(name::String)::String
if haskey(registers, name)
registers[name] += 1
else
registers[name] = 1
end
return String(["%", name, registers[name]])
end
function get_used_registers()
return pairs(registers)
end
end
# To increase performance, it would probably be best for all helper functions to return their IO Buffer and not a string
const exitJumpLocationMarker = "\$L__BB0_2"
function transpile(expression::ExpressionProcessing.PostfixType)::String
@ -297,7 +271,30 @@ function get_ptx_operator(operator::Operator)::String
end
end
let registers = Dict() # stores the count of the register already used.
global get_next_free_register
global get_used_registers
# By convention these names correspond to the following types:
# - p -> pred
# - f32 -> float32
# - b32 -> 32 bit
# - var -> float32
# - param -> float32 !! although, they might get inserted as fixed number and not be sent to gpu?
function get_next_free_register(name::String)::String
if haskey(registers, name)
registers[name] += 1
else
registers[name] = 1
end
return string("%", name, registers[name])
end
function get_used_registers()
return pairs(registers)
end
end
end