vosen/ZLUDA · error
unsupported format
Error message
unsupported format
What it means
Panic in format_byte_size: the CUarray_format enum value passed by the CUDA application has no entry in the match, so no element byte size can be determined. ZLUDA's emulation of texture reads only supports the fixed set of 8/16/32-bit int, half, and float formats; any other (or future/invalid) format value hits the catch-all arm and aborts.
Source
Thrown at zluda/src/impl/tex.rs:216
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
enum TexDim {
One,
Two,
Three,
}
/// Returns the byte size of a single element for the given format.
fn format_byte_size(fmt: CUarray_format) -> usize {
match fmt {
CUarray_format_enum::CU_AD_FORMAT_UNSIGNED_INT8
| CUarray_format_enum::CU_AD_FORMAT_SIGNED_INT8 => 1,
CUarray_format_enum::CU_AD_FORMAT_UNSIGNED_INT16
| CUarray_format_enum::CU_AD_FORMAT_SIGNED_INT16
| CUarray_format_enum::CU_AD_FORMAT_HALF => 2,
CUarray_format_enum::CU_AD_FORMAT_UNSIGNED_INT32
| CUarray_format_enum::CU_AD_FORMAT_SIGNED_INT32
| CUarray_format_enum::CU_AD_FORMAT_FLOAT => 4,
_ => panic!("unsupported format"),
}
}
/// Returns true if the format is a floating-point type (HALF or FLOAT).
fn format_is_float(fmt: CUarray_format) -> bool {
matches!(
fmt,
CUarray_format_enum::CU_AD_FORMAT_HALF | CUarray_format_enum::CU_AD_FORMAT_FLOAT
)
}
/// Write a test value into a host buffer at the given byte offset.
/// Returns the expected 4xi32 or 4xf32 result (as [u32; 4] bit pattern).
fn write_test_pixel(
host_buf: &mut [u8],
offset: usize,
fmt: CUarray_format,
num_channels: u32,View on GitHub (pinned to 9c8b43f242)
Solutions
- Check which CUarray_format the application sets via cuArrayCreate/cuTexRefSetFormat and use a supported format (INT8/16/32, HALF, FLOAT)
- Update ZLUDA — newer versions may cover additional formats
- For a local build, add the missing format arm with its element size
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at zluda/src/impl/tex.rs:216 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of vosen/ZLUDA@9c8b43f242 (2026-09-06).
Data as JSON: /api/errors/452002ddf80f55e6.
Report an issue: GitHub.