PXL
launch_result.hpp
Go to the documentation of this file.
1 // SPDX-License-Identifier: Apache-2.0
2 // Copyright 2024 XCENA Inc.
3 
4 #pragma once
5 
6 #include <string>
7 
8 #include "pxl/type.hpp"
9 
10 namespace pxl
11 {
12 
14 {
16  double elapsedUs = 0.0;
17  std::string errorMessage;
18 };
19 
20 // Centralized error-message constants — keeps the public LaunchResult.errorMessage
21 // strings stable so tests and downstream tooling can match on them.
22 inline constexpr const char* kAlreadyCalledMessage =
23  "run/runAsync already called on this builder";
24 // Common reasons this fires:
25 // - The kernel was called with only scalar args (no device pointers): pass
26 // an explicit device via Launcher(deviceId).
27 // - A pointer argument was passed but it was NOT returned by
28 // pxl::allocateMemory (e.g. it points at host malloc / static / stack
29 // memory). pxl cannot infer a device from such pointers.
30 // - The default device cache is unpopulated and no device is available.
31 inline constexpr const char* kNoDeviceResolvedMessage =
32  "No device resolved — pointer arguments must come from pxl::allocateMemory(), "
33  "or use Launcher(deviceId) for scalar-only kernels";
34 
35 } // namespace pxl
Definition: config.hpp:11
constexpr const char * kAlreadyCalledMessage
Result
Definition: type.hpp:55
constexpr const char * kNoDeviceResolvedMessage
std::string errorMessage