Archived
kbench: calibrate ungated on a backend without gates
The launch floor and the read-bandwidth probe needed a gate and gave up
without one, which withheld every device timing on SYCL once its gates
were removed (8931aae8). Both now run ungated there: the read probe's
launches move megabytes each, so the queue stays ahead of the host; the
floor then includes the host's submission time where that is longer,
and the header says so. Gated backends are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8931aae8b2
commit
eda5b01708
2 files changed
+16
-6
No files matched your search
+15
-6
@@ -399,14 +399,17 @@ double DeviceTimer::read_rate(const uint8_t* src, int64_t bytes, int64_t copies,
|
||||
for (int r = 0; r < 12; ++r) {
|
||||
void* gate = nullptr;
|
||||
sweep(sweep_bytes_);
|
||||
if (rad_stream_gate(s_, &gate) < 0) return -1;
|
||||
const int64_t room = rad_gate_room(s_) - kRoomMargin - kWarmUnits;
|
||||
/* Ungated on a backend without gates: each read moves megabytes, far longer than the
|
||||
* host takes to submit the next, so the queue stays ahead and the rate is the card's. */
|
||||
const bool gated = rad_stream_gate(s_, &gate) >= 0;
|
||||
if (!gated) (void)rad_dev_last_error();
|
||||
const int64_t room = gated ? rad_gate_room(s_) - kRoomMargin - kWarmUnits : 0;
|
||||
int rc = RAD_OK;
|
||||
for (int w = 0; w < kWarmUnits && rc >= 0; ++w) rc = read();
|
||||
(void)rad_event_record(ev_[kE0], s_);
|
||||
for (int64_t j = 0; j < n && rc >= 0; ++j) rc = read();
|
||||
(void)rad_event_record(ev_[kE1], s_);
|
||||
(void)rad_gate_open(gate);
|
||||
if (gate) (void)rad_gate_open(gate);
|
||||
if (rad_stream_sync(s_) < 0 || rc < 0) return -1;
|
||||
const double ms = ms_between(ev_[kE0], ev_[kE1]);
|
||||
if (ms <= 0) return -1;
|
||||
@@ -427,8 +430,11 @@ void DeviceTimer::calibrate() {
|
||||
for (int r = 0; r < 12 && (int)b2b.size() < 10; ++r) {
|
||||
void* gate = nullptr;
|
||||
sweep(sweep_bytes_);
|
||||
if (rad_stream_gate(s_, &gate) < 0) break;
|
||||
n = std::min<int64_t>(n, rad_gate_room(s_) - kRoomMargin - kWarmUnits);
|
||||
/* Without gates the floor is measured ungated, so it includes the host's submission
|
||||
* time when that is the longer (noted in the header). */
|
||||
ungated_floor_ = rad_stream_gate(s_, &gate) < 0;
|
||||
if (ungated_floor_) (void)rad_dev_last_error();
|
||||
else n = std::min<int64_t>(n, rad_gate_room(s_) - kRoomMargin - kWarmUnits);
|
||||
int rc = RAD_OK;
|
||||
for (int w = 0; w < kWarmUnits; ++w) rc |= rad_memset_async(word_, w, 4, s_);
|
||||
(void)rad_event_record(ev_[kE0], s_);
|
||||
@@ -437,7 +443,7 @@ void DeviceTimer::calibrate() {
|
||||
(void)rad_event_record(ev_[kB0], s_);
|
||||
rc |= rad_memset_async(word_, 1, 4, s_);
|
||||
(void)rad_event_record(ev_[kB1], s_);
|
||||
(void)rad_gate_open(gate);
|
||||
if (gate) (void)rad_gate_open(gate);
|
||||
if (rad_stream_sync(s_) < 0 || rc != RAD_OK) break;
|
||||
const double ms = ms_between(ev_[kE0], ev_[kE1]);
|
||||
const double one = ms_between(ev_[kB0], ev_[kB1]);
|
||||
@@ -451,6 +457,9 @@ void DeviceTimer::calibrate() {
|
||||
"alone between two events (the backend's own 4-byte fill, the "
|
||||
"cheapest kernel a tool can launch); a batch lasts at least %.0f us",
|
||||
floor_us_, floor_bracketed_us_, batch_target_us(floor_us_)));
|
||||
if (ungated_floor_)
|
||||
header_.push_back("launch floor measured ungated (this backend has no gates): it "
|
||||
"includes the host's submission time per launch where that is longer");
|
||||
}
|
||||
|
||||
/* Streaming-read bandwidth at four sizes up to the footprint, warm (one buffer reread) and
|
||||
|
||||
@@ -143,6 +143,7 @@ private:
|
||||
int64_t sweep_bytes_ = 0, sweep_max_ = 0, sweep_off_ = 0;
|
||||
void* word_ = nullptr; /* the launch floor's 256-byte target */
|
||||
double floor_us_ = -1, floor_bracketed_us_ = -1;
|
||||
bool ungated_floor_ = false; /* the floor was measured without a gate (none on this backend) */
|
||||
std::string metrics_path_;
|
||||
/* Throttler bits on at idle (some firmware keeps one set for good) and on after the warm-up's
|
||||
* sustained load (a power limit that binds throughout): neither makes a batch worth repeating,
|
||||
|
||||
Reference in new issue
Block a user