Commit 99cd02cf authored by Brice Videau's avatar Brice Videau
Browse files

Update cuda to print IPC handles correctly.

parent 819fe794
Pipeline #13135 failed with stage
......@@ -71,6 +71,8 @@ EOF
"s << \"#{p.name}: \#{CUDA::#{to_class_name(p.type.name)}.from_native(defi[\"#{p.name}\"], nil)}\""
elsif $all_bitfield_names.include?(p.type.name)
"s << \"#{p.name}: [ \#{CUDA::#{to_class_name(p.type.name)}.from_native(defi[\"#{p.name}\"], nil).join(\", \")} ]\""
elsif $all_struct_names.include?(p.type.name)
"s << \"#{p.name}: \#{CUDA::#{to_class_name(p.type.name)}.new(FFI::MemoryPointer.from_string(defi[\"#{p.name}\"]))}\""
else
"s << \"#{p.name}: \#{defi[\"#{p.name}\"]}\""
end
......
......@@ -179,6 +179,14 @@ end
module CUDA
extend FFI::Library
module Handle
def to_s
s = '{ reserved: "'
s << self[:reserved].to_a.collect { |v| "\\\\x%02x" % ((v + 256)%256) }.join
s << '" }'
end
end
module UUID
def to_s
a = self[:bytes].to_a.collect { |v| v < 0 ? 0x100 + v : v }
......@@ -245,6 +253,9 @@ def print_struct(name, struct)
EOF
puts <<EOF if to_class_name(name).match("UUID")
prepend UUID
EOF
puts <<EOF if to_class_name(name).match(/Handle\z/)
prepend Handle
EOF
puts <<EOF
layout #{members.collect(&print_lambda).join(",\n"+" "*11)}
......
......@@ -224,7 +224,7 @@ module ZE
module Handle
def to_s
s = '{ data: "'
s << self[:data].to_a.collect { |v| "%02x" % ((v + 256)%256) }.join(" ")
s << self[:data].to_a.collect { |v| "\\\\x%02x" % ((v + 256)%256) }.join
s << '" }'
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment