Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
HeteroFlow
THAPI
Commits
f9a58e8c
Commit
f9a58e8c
authored
Oct 12, 2020
by
Brice Videau
Browse files
Added support for dumping CUDA arguments.
parent
0d27e4b7
Pipeline
#11577
canceled with stage
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
cuda/cuda_export_tables.yaml
View file @
f9a58e8c
...
...
@@ -12,8 +12,8 @@
}
functions
:
-
offset
:
0x108
name
:
CUf
unction_get_arg_count
declaration
:
"
CUresult
CUf
unction_get_arg_count(CUfunction
f,
size_t
*
pArgCount)"
name
:
cuF
unction_get_arg_count
declaration
:
"
CUresult
cuF
unction_get_arg_count(CUfunction
f,
size_t
*
pArgCount)"
-
offset
:
0x110
name
:
CUf
unction_get_arg_descriptor
declaration
:
"
CUresult
CUf
unction_get_arg_descriptor(CUfunction
f,
size_t
argIndex,
CUfunction_arg_desc_query
*pArgDescQuery)"
name
:
cuF
unction_get_arg_descriptor
declaration
:
"
CUresult
cuF
unction_get_arg_descriptor(CUfunction
f,
size_t
argIndex,
CUfunction_arg_desc_query
*pArgDescQuery)"
cuda/cuda_model.rb
View file @
f9a58e8c
...
...
@@ -748,3 +748,10 @@ end
CUDA_POINTER_NAMES
=
(
$cuda_commands
).
collect
{
|
c
|
[
c
,
upper_snake_case
(
c
.
pointer_name
)]
}.
to_h
dump_args
=
<<
EOF
_dump_kernel_args(f, kernelParams, extra);
EOF
register_prologue
"cuLaunchKernel"
,
dump_args
register_prologue
"cuLaunchKernel_ptsz"
,
dump_args
cuda/gen_babeltrace_cuda_lib.rb
View file @
f9a58e8c
...
...
@@ -16,6 +16,8 @@ meta_parameter_lambda = lambda { |m, dir|
when
YAMLCAst
::
CustomType
if
$objects
.
include?
(
t
.
name
)
"s <<
\"
#{
name
}
:
\#
{
\"
0x%016x
\"
% defi[
\"
#{
name
}
\"
]}
\"
"
elsif
t
.
name
==
"CUdeviceptr"
"s <<
\"
#{
name
}
:
\#
{
\"
0x%016x
\"
% defi[
\"
#{
name
}
\"
]}
\"
"
elsif
$all_enum_names
.
include?
(
t
.
name
)
"s <<
\"
#{
name
}
:
\#
{CUDA::
#{
to_class_name
(
t
.
name
)
}
.from_native(defi[
\"
#{
name
}
\"
], nil)}
\"
"
elsif
$all_bitfield_names
.
include?
(
t
.
name
)
...
...
cuda/gen_cuda.rb
View file @
f9a58e8c
...
...
@@ -5,6 +5,7 @@ puts <<EOF
#include <cuda.h>
#include <pthread.h>
#include "cuda_tracepoints.h"
#include "cuda_args.h"
EOF
$cuda_commands
.
each
{
|
c
|
...
...
@@ -74,7 +75,7 @@ EOF
table
[
"functions"
].
each
{
|
func
|
puts
<<
EOF
if (0x
#{
func
[
"offset"
].
to_s
(
16
)
}
< tableSize) {
#{
upper_snake_case
(
func
[
"name"
]
+
"_ptr"
)
}
= (
#{
func
[
"name"
]
}
_t)((intptr_t)pExportTable + 0x
#{
func
[
"offset"
].
to_s
(
16
)
}
);
#{
upper_snake_case
(
func
[
"name"
]
+
"_ptr"
)
}
=
*
(
#{
func
[
"name"
]
}
_t
*
)((intptr_t)pExportTable + 0x
#{
func
[
"offset"
].
to_s
(
16
)
}
);
}
EOF
}
...
...
cuda/tracer_cuda.sh.in
View file @
f9a58e8c
...
...
@@ -20,7 +20,8 @@ whichlib() {
while
true
;
do
case
"
$1
"
in
--cudart
)
shift
;
cudart
=
1
;;
-v
|
--visualize
)
shift
;
lttng_view
=
1
;;
-a
|
--arguments
)
shift
;
arguments
=
1
;;
-v
|
--visualize
)
shift
;
lttng_view
=
1
;;
--
)
shift
;
break
;;
*
)
break
;;
esac
...
...
@@ -40,6 +41,10 @@ if [ ! -z "$cudart" ]
then
lttng enable-event
--channel
=
blocking-channel
--userspace
lttng_ust_cudart:
*
fi
if
[
!
-z
"
$arguments
"
]
then
lttng enable-event
--channel
=
blocking-channel
--userspace
lttng_ust_cuda_args:
*
fi
if
[
-z
"
$LTTNG_UST_CUDA_LIBCUDA
"
]
then
export
LTTNG_UST_CUDA_LIBCUDA
=
$(
whichlib libcuda.so |
head
-n
1
)
...
...
cuda/tracer_cuda_helpers.include.c
View file @
f9a58e8c
static
inline
void
_dump_kernel_args
(
CUfunction
f
,
void
**
kernelParams
,
void
**
extra
)
{
(
void
)
extra
;
size_t
argCount
;
CUresult
res
;
int
count
=
0
;
CUfunction_arg_desc_query
q
;
if
(
tracepoint_enabled
(
lttng_ust_cuda_args
,
arg_count
))
{
res
=
CU_FUNCTION_GET_ARG_COUNT_PTR
(
f
,
&
argCount
);
if
(
res
!=
CUDA_SUCCESS
)
return
;
count
=
1
;
do_tracepoint
(
lttng_ust_cuda_args
,
arg_count
,
f
,
argCount
);
}
if
(
tracepoint_enabled
(
lttng_ust_cuda_args
,
arg_value
))
{
if
(
!
count
)
{
res
=
CU_FUNCTION_GET_ARG_COUNT_PTR
(
f
,
&
argCount
);
if
(
res
!=
CUDA_SUCCESS
)
return
;
}
if
(
kernelParams
)
{
for
(
size_t
i
=
0
;
i
<
argCount
;
i
++
)
{
q
.
sz
=
0x28
;
res
=
CU_FUNCTION_GET_ARG_DESCRIPTOR_PTR
(
f
,
i
,
&
q
);
if
(
res
==
CUDA_SUCCESS
)
{
do_tracepoint
(
lttng_ust_cuda_args
,
arg_value
,
f
,
i
,
kernelParams
[
i
],
q
.
argSize
);
}
}
}
if
(
extra
)
{
void
*
argBuffer
=
NULL
;
size_t
argBufferSize
=
0
;
int
indx
=
0
;
while
(
extra
[
indx
]
!=
CU_LAUNCH_PARAM_END
)
{
if
((
void
*
)
CU_LAUNCH_PARAM_BUFFER_POINTER
==
extra
[
indx
])
{
argBuffer
=
extra
[
indx
+
1
];
}
else
if
((
void
*
)
CU_LAUNCH_PARAM_BUFFER_SIZE
==
extra
[
indx
])
{
argBufferSize
=
*
(
size_t
*
)(
extra
+
indx
+
1
);
}
indx
+=
2
;
}
if
(
argBuffer
&&
argBufferSize
)
{
for
(
size_t
i
=
0
;
i
<
argCount
;
i
++
)
{
q
.
sz
=
0x28
;
res
=
CU_FUNCTION_GET_ARG_DESCRIPTOR_PTR
(
f
,
i
,
&
q
);
if
(
res
==
CUDA_SUCCESS
&&
argBufferSize
>=
q
.
argOffset
+
q
.
argSize
)
{
do_tracepoint
(
lttng_ust_cuda_args
,
arg_value
,
f
,
i
,
(
void
*
)((
intptr_t
)
argBuffer
+
q
.
argOffset
),
q
.
argSize
);
}
}
}
}
}
}
static
pthread_once_t
_init
=
PTHREAD_ONCE_INIT
;
static
__thread
volatile
int
in_init
=
0
;
static
volatile
int
_initialized
=
0
;
...
...
ze/tracer_ze.sh.in
View file @
f9a58e8c
...
...
@@ -20,7 +20,7 @@ whichlib() {
while
true
;
do
case
"
$1
"
in
-p
|
--profiling
)
shift
;
profiling
=
1
;
export
LTTNG_UST_ZE_PROFILE
=
1
;;
-v
|
--visualize
)
shift
;
lttng_view
=
1
;;
-v
|
--visualize
)
shift
;
lttng_view
=
1
;;
--properties
)
shift
;
properties
=
1
;;
--
)
shift
;
break
;;
*
)
break
;;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment