Skip to content

Commit

Permalink
Fixes for CUDA 11.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Aug 12, 2023
1 parent b1573b9 commit da34fa7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/cupti/wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function process(f, cfg::ActivityConfig)
elseif cuda_version >= v"11.1"
CUpti_ActivityMemcpy4
else # v"11.0"
CUpti_ActivityMemset3
CUpti_ActivityMemcpy3
end
activity_types[CUPTI_ACTIVITY_KIND_MEMSET] =
if cuda_version >= v"11.6"
Expand Down
36 changes: 23 additions & 13 deletions src/profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@ function emit_native_profile(code, kwargs)
# memory operations
CUPTI.CUPTI_ACTIVITY_KIND_MEMCPY,
CUPTI.CUPTI_ACTIVITY_KIND_MEMSET,
# additional information for API host calls
CUPTI.CUPTI_ACTIVITY_KIND_MEMORY2,
]
if CUDA.runtime_version() >= v"11.2"
# additional information for API host calls
push!(activity_kinds, CUPTI.CUPTI_ACTIVITY_KIND_MEMORY2)
end

quote
cfg = CUPTI.ActivityConfig($activity_kinds)
Expand Down Expand Up @@ -262,17 +264,25 @@ function generate_traces(cfg)
id = record.correlationId
t0, t1 = record.start/1e9, record._end/1e9

name = if record.kind == CUPTI.CUPTI_ACTIVITY_KIND_DRIVER
ref = Ref{Cstring}(C_NULL)
CUPTI.cuptiGetCallbackName(CUPTI.CUPTI_CB_DOMAIN_DRIVER_API,
record.cbid, ref)
unsafe_string(ref[])
elseif record.kind == CUPTI.CUPTI_ACTIVITY_KIND_RUNTIME
ref = Ref{Cstring}(C_NULL)
CUPTI.cuptiGetCallbackName(CUPTI.CUPTI_CB_DOMAIN_RUNTIME_API,
record.cbid, ref)
unsafe_string(ref[])
else
name = try
if record.kind == CUPTI.CUPTI_ACTIVITY_KIND_DRIVER
ref = Ref{Cstring}(C_NULL)
CUPTI.cuptiGetCallbackName(CUPTI.CUPTI_CB_DOMAIN_DRIVER_API,
record.cbid, ref)
unsafe_string(ref[])
elseif record.kind == CUPTI.CUPTI_ACTIVITY_KIND_RUNTIME
ref = Ref{Cstring}(C_NULL)
CUPTI.cuptiGetCallbackName(CUPTI.CUPTI_CB_DOMAIN_RUNTIME_API,
record.cbid, ref)
unsafe_string(ref[])
else
"<unknown>"
end
catch err
# XXX: as observed on CUDA 11.0
(isa(err, CUPTIError) &&
err.code == CUPTI.CUPTI_ERROR_INVALID_PARAMETER) ||
rethrow()
"<unknown>"
end

Expand Down

0 comments on commit da34fa7

Please sign in to comment.