diff --git a/sycl/src/program/generate.cpp b/sycl/src/program/generate.cpp index 9fcce587..f21548df 100644 --- a/sycl/src/program/generate.cpp +++ b/sycl/src/program/generate.cpp @@ -1500,15 +1500,17 @@ bool load_control_vectors(const Options& o, const strata::core::ModelGeometry& g // median would still follow a disturbance that lasts through half the bursts). Each burst takes ~10 ms on an x16 // PCIe 4 link, so the probe takes no longer than the one 1 GiB burst did. `samples`, when given, gets every // burst's reading for the log. -double probe_pcie_h2d_gbps(std::string *samples = nullptr) try { +double probe_pcie_h2d_gbps(std::string *samples = nullptr, bool pin_source = false) try { constexpr size_t kBytes = 256ull << 20; constexpr int kBursts = 4; void* h = nullptr; void* d = nullptr; - if (DPCT_CHECK_ERROR(h = (void *)sycl::malloc_host(kBytes, dpct::get_in_order_queue())) != 0) return -1.0; + // PR #1669: a pageable source made the copy engine fault on a layer split (VM_NOT_FOUND), so a split pins it. A single card keeps the + // pageable source of 0.1.41: pinned reads 1.7x faster, which moves the default pcie_frac (A750 0.28 -> 0.47, 10% slower decode). + if (DPCT_CHECK_ERROR(h = pin_source ? (void *)sycl::malloc_host(kBytes, dpct::get_in_order_queue()) : (void *)malloc(kBytes)) != 0 || h == nullptr) return -1.0; if (DPCT_CHECK_ERROR(d = (void *)sycl::malloc_device( kBytes, dpct::get_in_order_queue())) != 0) { - sycl::free(h, dpct::get_in_order_queue()); + if (pin_source) sycl::free(h, dpct::get_in_order_queue()); else free(h); return -1.0; } std::memset(h, 0, kBytes); // fault the pages in before timing @@ -1577,7 +1579,7 @@ double probe_pcie_h2d_gbps(std::string *samples = nullptr) try { */ if (!ok)(void) 0; sycl::free(d, dpct::get_in_order_queue()); - sycl::free(h, dpct::get_in_order_queue()); + if (pin_source) sycl::free(h, dpct::get_in_order_queue()); else free(h); return bw; } catch (sycl::exception const &exc) { @@ -2537,7 +2539,7 @@ int main(int argc, char **argv) try { if (o.pcie_frac < 0.0) { const double base = native_pack ? 0.55 : 0.2; std::string bursts; - const double bw = native_pack ? probe_pcie_h2d_gbps(&bursts) : -1.0; + const double bw = native_pack ? probe_pcie_h2d_gbps(&bursts, multi_gpu) : -1.0; if (!native_pack) { o.pcie_frac = base; } else if (bw > 0.0) { @@ -3337,7 +3339,7 @@ int main(int argc, char **argv) try { st.pcie_frac = o.pcie_frac; if (!pcie_given && native_pack) { std::string bursts; - const double bw = probe_pcie_h2d_gbps(&bursts); + const double bw = probe_pcie_h2d_gbps(&bursts, true); if (bw > 0.0) st.pcie_frac = pcie_frac_for_gbps(bw, 0.55); std::fprintf(stderr, "strata generate: layer split: CUDA%d PCIe probe %.1f GB/s (best of %s) -> pcie_frac " "%.2f\n", st.dev, bw, bursts.c_str(), st.pcie_frac);