PXL
config.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 <cstddef>
7 #include <cstdint>
8 #include <initializer_list>
9 
10 namespace pxl
11 {
12 
13 // --- Logging ---
14 
15 enum class LogType
16 {
17  Resource,
18  Execution,
19  Internal,
20  All,
21  NumLogType = All
22 };
23 
24 enum class LogLevel
25 {
26  Error,
27  Info,
28  Debug,
29 };
30 
31 enum class LogDetail
32 {
33  None,
34  TimeStamp,
36  All,
37 };
38 
39 enum class LogOutput
40 {
41  Stdout,
42  Stderr,
43  File,
44 };
45 
58 void enableLog(const LogType& type, const LogLevel& level = LogLevel::Error, const LogDetail& detail = LogDetail::None);
59 
70 void disableLog(const LogType& type);
71 
83 void setOutput(const LogOutput& outputType, const char* filename = nullptr);
84 
85 // --- Signal Handler ---
86 
103 void registerSignalHandler(int32_t signalType);
104 
115 void registerSignalHandler(const std::initializer_list<int32_t>& signalLists);
116 
117 // --- Host Cache Flush ---
118 
156 void flushHostCache(void* hostVirtualPtr, size_t size, bool opt = true);
157 
210 void flushHostCacheUntracked(void* hostVirtualPtr, size_t size, bool opt = true);
211 
249 void invalidateHostCache(void* hostVirtualPtr, size_t size);
250 
251 } // namespace pxl
Definition: config.hpp:11
LogDetail
Definition: config.hpp:32
void enableLog(const LogType &type, const LogLevel &level=LogLevel::Error, const LogDetail &detail=LogDetail::None)
Configures logging settings for a specific log type.
void disableLog(const LogType &type)
Disables logging for a specific log type.
LogType
Definition: config.hpp:16
void invalidateHostCache(void *hostVirtualPtr, size_t size)
Drops host cache lines over the range so a later read sees what the device wrote.
LogLevel
Definition: config.hpp:25
void setOutput(const LogOutput &outputType, const char *filename=nullptr)
Sets the output destination for log messages.
void flushHostCacheUntracked(void *hostVirtualPtr, size_t size, bool opt=true)
Flushes the host CPU cache, and nothing else.
void registerSignalHandler(int32_t signalType)
Registers a signal handler for a specific signal type.
LogOutput
Definition: config.hpp:40
void flushHostCache(void *hostVirtualPtr, size_t size, bool opt=true)
Flushes the host CPU cache for the specified memory range and records the range as written.