METALVALIDATION(1) | General Commands Manual | METALVALIDATION(1) |
Metal Validation
—
Metal Runtime Validation
MTL_DEBUG_LAYER
MTL_DEBUG_LAYER_ERROR_MODE
MTL_DEBUG_LAYER_WARNING_MODE
MTL_DEBUG_LAYER_VALIDATE_LOAD_ACTIONS
MTL_DEBUG_LAYER_VALIDATE_STORE_ACTIONS
MTL_DEBUG_LAYER_VALIDATE_UNRETAINED_RESOURCES
MTL_SHADER_VALIDATION
MTL_SHADER_VALIDATION_DEFAULT_STATE
MTL_SHADER_VALIDATION_ENABLE_PIPELINES
MTL_SHADER_VALIDATION_DISABLE_PIPELINES
MTL_SHADER_VALIDATION_DUMP_PIPELINES
MTL_SHADER_VALIDATION_ENABLE_ERROR_REPORTING
MTL_SHADER_VALIDATION_TEXTURE_USAGE
MTL_SHADER_VALIDATION_THREADGROUP_MEMORY
MTL_SHADER_VALIDATION_RESOURCE_USAGE
MTL_SHADER_VALIDATION_COMPILER_INLINING
MTL_SHADER_VALIDATION_FAIL_MODE
MTL_SHADER_VALIDATION_REPORT_TO_STDERR
Unless otherwise noted all environment variables listed must be set before any Metal device is created in the process. Any changes to these values after device creation will not take effect.
Metal provides two modes of validation, API and GPU.
API validation validates CPU API usage correctness such as calling draw without a pipeline set.
GPU validation validates GPU API correctness such as accessing invalid GPU memory.
Setting "assert" will cause the debug layer to log and then assert on error.
Setting "ignore" will cause the debug layer to ignore errors, this may cause undefined behavior.
Setting "nslog" will cause the debug layer to log errors using NSLog, this may cause undefined behavior.
Setting "assert" will cause the debug layer to log and then assert on warnings.
Setting "ignore" will cause the debug layer to ignore warnings.
Setting "nslog" will cause the debug layer to log warnings using NSLog.
0x1 : Enabling this flag will cause command buffer to tag any objects bound to the command buffer, which are not retained internally. If a tagged object is deallocated before the command buffer completes, an error is raised.
0x2 : Enabling this flag will cause command buffer to tag objects that are internally retained by the command buffer. This should usually not be needed, because an object cannot be deallocated while the command buffer itself isn't complete.
0x4 : Enabling this flag will cause deallocated tagged objects to be considered an error even before committing the command buffer. This will lead to more immediate error (ie: in the call stack of the dealloc) rather than at commit, which is more debuggable.
MTL_SHADER_VALIDATION_ENABLE_PIPELINES
and
MTL_SHADER_VALIDATION_DISABLE_PIPELINES
MTL_SHADER_VALIDATION_DUMP_PIPELINES)
for which
Shader Validation should be enabled. Only relevant when
MTL_SHADER_VALIDATION_DEFAULT_STATE is set to "none".
MTL_SHADER_VALIDATION_DUMP_PIPELINES)
for which
Shader Validation should be disabled. Only relevant when
MTL_SHADER_VALIDATION_DEFAULT_STATE is set to "all".
MTL_SHADER_VALIDATION_ENABLE_PIPELINES
and
MTL_SHADER_VALIDATION_DISABLE_PIPELINES
If this value is set to any non-zero value, shader validation
will instrument all global memory accesses and result of accessing
invalid memory is determined by
MTL_SHADER_VALIDATION_FAIL_MODE
If this value is set to any non-zero value, shader validation
will instrument all texture member functions (e.g read, write,
get_width) and the result of the following operations on the GPU is
determined by MTL_SHADER_VALIDATION_FAIL_MODE
1. Accessing a nil texture object
2. Accessing a texture object with a type different than what is expected
by the shader signature
3. Accessing a non-resident texture or without the appropriate
MTLResourceUsage flag set on a useResource or useHeap call
If this value is set to any non-zero value, shader validation
will instrument all threadgroup memory accesses and result of accessing
invalid memory is determined by
MTL_SHADER_VALIDATION_FAIL_MODE
If this value is set to any non-zero value, shader validation
will instrument all resource accesses to check resource usage. It will
detect missing calls to useResource and useHeap with the appropriate
MTLResourceUsage flag on resources used by the GPU. The result of
accessing invalid memory is determined by
MTL_SHADER_VALIDATION_FAIL_MODE
If this value is set to any non-zero value, shader validation will instrument all indirect calls (calls by function pointer, visible functions, intersection functions, dylib calls) and recursive calls. If the call stack depth for such functions exeecds the value set for "maxCallStackDepth" for that stage, an error will be raised and the function call will be skipped.
Determines whether code inlining will occur.
Setting this value to "full" will force inlining
Adding inlining may result in improved runtime performance at the cost of
compile time performance.
Reducing inlining may result in improved compile time performance at the
cost of runtime performance.
Sets the behavior for how invalid accesses should be handled. Setting this value to "zerofill" causes invalid reads to return 0. Invalid writes are dropped.
Setting this value to "allow" allows the invalid read or write, which may result in command buffer failure depending on platform, but has reduced compile & runtime performance impact.
05/03/20 | Darwin |