Skip to content

Commit f39016d

Browse files
authored
[ET-VK] Update vulkan gpuinfo code for staging buffer changes (#16664)
Summary: In D89086669, we updated StagingBuffer to take a flag specifying transfer direction (CPU->GPU or GPU->CPU). I missed the call sites under tools/gpuinfo. This PR updates these call sites to make the tool buildable again. Differential Revision: D90888995 cc @SS-JIA @manuelcandales @digantdesai @cbilgin
1 parent 019c087 commit f39016d

3 files changed

Lines changed: 37 additions & 9 deletions

File tree

backends/vulkan/tools/gpuinfo/include/architecture.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ void reg_count(const App& app) {
4040
uint32_t NITER;
4141

4242
auto bench = [&](uint32_t ngrp, uint32_t nreg) {
43-
StagingBuffer buffer(context(), vkapi::kFloat, 1);
43+
StagingBuffer buffer(
44+
context(), vkapi::kFloat, 1, vkapi::CopyDirection::DEVICE_TO_HOST);
4445
vkapi::PipelineBarrier pipeline_barrier{};
4546

4647
auto shader_name = "reg_count_" + std::to_string(nreg);
@@ -164,7 +165,11 @@ void warp_size(const App& app, const bool verbose = false) {
164165
uint32_t NITER;
165166

166167
auto bench = [&](uint32_t nthread) {
167-
StagingBuffer out_buf(context(), vkapi::kInt, app.nthread_logic);
168+
StagingBuffer out_buf(
169+
context(),
170+
vkapi::kInt,
171+
app.nthread_logic,
172+
vkapi::CopyDirection::DEVICE_TO_HOST);
168173
vkapi::PipelineBarrier pipeline_barrier{};
169174

170175
auto shader_name = "warp_size_physical";
@@ -224,7 +229,11 @@ void warp_size(const App& app, const bool verbose = false) {
224229
// doesn't depend on kernel timing, so the extra wait time doesn't lead to
225230
// inaccuracy.
226231
auto bench_sm = [&](uint32_t nthread) {
227-
StagingBuffer out_buf(context(), vkapi::kInt, app.nthread_logic);
232+
StagingBuffer out_buf(
233+
context(),
234+
vkapi::kInt,
235+
app.nthread_logic,
236+
vkapi::CopyDirection::DEVICE_TO_HOST);
228237
vkapi::PipelineBarrier pipeline_barrier{};
229238

230239
auto shader_name = "warp_size_scheduler";

backends/vulkan/tools/gpuinfo/include/buffers.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,13 @@ void buf_cacheline_size(const App& app) {
3535
uint32_t NITER;
3636

3737
auto bench = [&](int stride) {
38-
StagingBuffer in_buf(context(), vkapi::kFloat, BUF_SIZE);
39-
StagingBuffer out_buf(context(), vkapi::kFloat, 1);
38+
StagingBuffer in_buf(
39+
context(),
40+
vkapi::kFloat,
41+
BUF_SIZE,
42+
vkapi::CopyDirection::HOST_TO_DEVICE);
43+
StagingBuffer out_buf(
44+
context(), vkapi::kFloat, 1, vkapi::CopyDirection::DEVICE_TO_HOST);
4045
vkapi::PipelineBarrier pipeline_barrier{};
4146

4247
auto shader_name = "buf_cacheline_size";
@@ -132,9 +137,16 @@ void _bandwidth(
132137
// workgroups, once the size of the access excedes the workgroup width.
133138
const uint32_t workgroup_width = local_x * NITER * NUNROLL;
134139

135-
StagingBuffer in_buf(context(), vkapi::kFloat, range / sizeof(float));
140+
StagingBuffer in_buf(
141+
context(),
142+
vkapi::kFloat,
143+
range / sizeof(float),
144+
vkapi::CopyDirection::HOST_TO_DEVICE);
136145
StagingBuffer out_buf(
137-
context(), vkapi::kFloat, VEC_WIDTH * app.nthread_logic);
146+
context(),
147+
vkapi::kFloat,
148+
VEC_WIDTH * app.nthread_logic,
149+
vkapi::CopyDirection::DEVICE_TO_HOST);
138150
vkapi::PipelineBarrier pipeline_barrier{};
139151

140152
auto shader_name = "buf_bandwidth_" + memtype_lower;

backends/vulkan/tools/gpuinfo/include/textures.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ void tex_cacheline_concurr(const App& app) {
6161
vTensor in_tensor =
6262
api::vTensor(api::context(), sizes_nchw, vkapi::kFloat);
6363

64-
StagingBuffer out_buf(context(), vkapi::kFloat, TEXEL_WIDTH);
64+
StagingBuffer out_buf(
65+
context(),
66+
vkapi::kFloat,
67+
TEXEL_WIDTH,
68+
vkapi::CopyDirection::DEVICE_TO_HOST);
6569

6670
vkapi::PipelineBarrier pipeline_barrier{};
6771

@@ -174,7 +178,10 @@ void tex_bandwidth(const App& app) {
174178
const uint32_t workgroup_width = local_x * NITER * NUNROLL;
175179

176180
StagingBuffer out_buf(
177-
context(), vkapi::kFloat, VEC_WIDTH * app.nthread_logic);
181+
context(),
182+
vkapi::kFloat,
183+
VEC_WIDTH * app.nthread_logic,
184+
vkapi::CopyDirection::DEVICE_TO_HOST);
178185
vkapi::PipelineBarrier pipeline_barrier{};
179186

180187
auto time = benchmark_on_gpu(shader_name, 10, [&]() {

0 commit comments

Comments
 (0)