@@ -29,14 +29,14 @@ function code_sass_callback(userdata::Ptr{Cvoid}, domain::CUpti_CallbackDomain,
29
29
end
30
30
31
31
"""
32
- code_sass([io], f, types; verbose =false)
32
+ code_sass([io], f, types; raw =false)
33
33
34
34
Prints the SASS code generated for the method matching the given generic function and type
35
35
signature to `io` which defaults to `stdout`.
36
36
37
37
The following keyword arguments are supported:
38
38
39
- - `verbose `: enable verbose mode, which displays code generation statistics
39
+ - `raw `: dump the assembly like `nvdisasm` reports it, without post-processing;
40
40
- all keyword arguments from [`cufunction`](@ref)
41
41
42
42
See also: [`@device_code_sass`](@ref)
52
52
# multiple subscribers aren't supported, so make sure we only call CUPTI once
53
53
const cupti_lock = ReentrantLock ()
54
54
55
- function code_sass (io:: IO , job:: CompilerJob ; verbose :: Bool = false )
55
+ function code_sass (io:: IO , job:: CompilerJob ; raw :: Bool = false )
56
56
if ! job. config. kernel
57
57
error (" Can only generate SASS code for kernel functions" )
58
58
end
@@ -97,13 +97,15 @@ function code_sass(io::IO, job::CompilerJob; verbose::Bool=false)
97
97
98
98
cmd = ` $(nvdisasm ()) --print-code --print-line-info $cubin_path `
99
99
for line in readlines (cmd)
100
- # nvdisasm output is pretty verbose;
101
- # perform some clean-up and make it look like @code_native
102
- line = replace (line, r" /\* [0-9a-f]{4}\* /" => " " ) # strip inst addr
103
- line = replace (line, r" ^[ ]{30}" => " " ) # reduce leading spaces
104
- line = replace (line, r" [\s +]//##" => " ;" ) # change line info tag
105
- line = replace (line, r" ^\. " => " \n ." ) # break before new BBs
106
- line = replace (line, r" ; File \" (.+?)\" , line (\d +)" => s " ; Location \1 :\2 " ) # rename line info
100
+ if ! raw
101
+ # nvdisasm output is pretty verbose;
102
+ # perform some clean-up and make it look like @code_native
103
+ line = replace (line, r" /\* [0-9a-f]{4}\* /" => " " ) # strip inst addr
104
+ line = replace (line, r" ^[ ]{30}" => " " ) # reduce leading spaces
105
+ line = replace (line, r" [\s +]//##" => " ;" ) # change line info tag
106
+ line = replace (line, r" ^\. " => " \n ." ) # break before new BBs
107
+ line = replace (line, r" ; File \" (.+?)\" , line (\d +)" => s " ; Location \1 :\2 " ) # rename line info
108
+ end
107
109
println (io, line)
108
110
end
109
111
end
0 commit comments