Commit 27199ba5 authored by dummycoderfe's avatar dummycoderfe
Browse files

debug add cache

parent 31bf253a
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <hip/hip_runtime.h> #include <hip/hip_runtime.h>
#include <stdint.h> #include <stdint.h>
#include <stdexcept> #include <stdexcept>
#include <iostream>
#include "ck_tile/host/hip_check_error.hpp" #include "ck_tile/host/hip_check_error.hpp"
namespace ck_tile { namespace ck_tile {
......
...@@ -78,15 +78,21 @@ CK_TILE_HOST float launch_kernel(const stream_config& s, Callables... callables) ...@@ -78,15 +78,21 @@ CK_TILE_HOST float launch_kernel(const stream_config& s, Callables... callables)
} }
if(s.is_gpu_timer_) { if(s.is_gpu_timer_) {
gpu_timer timer {}; gpu_timer timer {};
float total_time = 0;
// warmup // warmup
for(int i = 0; i < s.cold_niters_; i++) { (callables(s),...); } HIP_CHECK_ERROR(hipGetLastError()); for(int i = 0; i < s.cold_niters_; i++) { (callables(s),...); } HIP_CHECK_ERROR(hipGetLastError());
timer.start(s.stream_id_); for(int i = 0; i < s.nrepeat_; i++) {
for(int i = 0; i < s.nrepeat_; i++) { (callables(s),...); } HIP_CHECK_ERROR(hipGetLastError()); if (s.clear_cache) {
timer.stop(s.stream_id_); s.cache_buf.SetValue<int>(i);
}
timer.start(s.stream_id_);
(callables(s),...);
timer.stop(s.stream_id_);
total_time += timer.duration();
} HIP_CHECK_ERROR(hipGetLastError());
return timer.duration() / s.nrepeat_; return total_time / s.nrepeat_;
} }
else { else {
cpu_timer timer {}; cpu_timer timer {};
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#pragma once #pragma once
#include <hip/hip_runtime.h> #include <hip/hip_runtime.h>
#include "device_memory.hpp"
namespace ck_tile { namespace ck_tile {
/* /*
...@@ -30,5 +31,8 @@ struct stream_config ...@@ -30,5 +31,8 @@ struct stream_config
int cold_niters_ = 3; int cold_niters_ = 3;
int nrepeat_ = 10; int nrepeat_ = 10;
bool is_gpu_timer_ = true; // keep compatible bool is_gpu_timer_ = true; // keep compatible
bool clear_cache = false;
size_t buf_size = 0;
DeviceMem cache_buf{buf_size};
}; };
} // namespace ck_tile } // namespace ck_tile
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