3#include <cuda_runtime.h>
34 size_t free_bytes = 0;
62template <
typename Config>
67template <
typename Config>
73template <
typename Config>
80template <
typename Config>
87template <
typename Config>
95template <
typename Config>
105 return budget <= 0.0 ?
size_t{0} :
static_cast<size_t>(
budget);
109template <
typename Config>
142template <
typename Config>
157template <
typename Config>
159 const std::filesystem::path&
path,
178template <
typename Config>
201 "{}: FASTX input requires more GPU memory than available at fill_fraction={} "
202 "(free staging budget {} bytes)",
constexpr uint64_t estimate_query_staging_bytes(uint64_t raw_bytes, uint64_t record_count) noexcept
Peak device bytes for query staging (d_sequence_ + d_resultBuffer_).
Result< cuda_free_memory > query_cuda_free_memory()
Queries current device free memory via cudaMemGetInfo.
uint64_t fastx_file_bytes(const std::filesystem::path &path)
constexpr bool fastx_chunk_reached_host_byte_limit(size_t host_chunk_max_bytes, uint64_t raw_chunk_bytes) noexcept
True when raw_chunk_bytes reaches the optional host assembly cap.
constexpr size_t fastx_pipelined_chunk_budget(fastx_chunk_mode mode, size_t staging_budget_bytes) noexcept
Per-chunk flush budget for dual-stream ping-pong (two device sequence buffers).
constexpr uint64_t estimate_insert_staging_bytes(uint64_t raw_bytes, uint64_t record_count) noexcept
Peak device bytes for insert staging (d_sequence_) for a host chunk.
constexpr size_t fastx_chunk_slack_bytes() noexcept
Reserved device memory left for allocator and kernel temporaries.
fastx_chunk_mode
FASTX mode used to size GPU staging buffers.
bool fastx_chunk_should_flush(fastx_chunk_mode mode, size_t gpu_staging_budget_bytes, size_t host_chunk_max_bytes, uint64_t raw_chunk_bytes, uint64_t record_count) noexcept
Whether a host chunk should flush based on GPU staging and host byte limits.
constexpr uint64_t fastx_record_kmer_count(uint64_t bases) noexcept
constexpr uint64_t estimate_normalized_sequence_bytes(uint64_t raw_bytes, uint64_t record_count) noexcept
Upper bound on normalized sequence bytes for a raw host chunk.
consteval bool separatorPositionAlwaysEncodesInvalid(char *input, uint64_t separatorPosition, uint64_t index)
Recursively tests whether placing the separator byte at any position in an input of valid bytes alway...
constexpr bool fastx_chunk_reached_staging_budget(fastx_chunk_mode mode, size_t staging_budget_bytes, uint64_t raw_bytes, uint64_t record_count) noexcept
Whether estimated device staging meets or exceeds staging_budget_bytes.
constexpr size_t fastx_staging_budget_bytes(double fill_fraction, size_t free_bytes) noexcept
Device staging byte budget derived from free VRAM and fill_fraction.
bool fastx_file_fits_gpu_staging(const std::filesystem::path &path, fastx_chunk_mode mode, double fill_fraction)
Whether the entire uncompressed file fits in one GPU staging pass.
Result< void > validate_fastx_staging_fits(fastx_chunk_mode mode, double fill_fraction, uint64_t raw_bytes, uint64_t record_count, std::string_view source_name)
constexpr uint64_t fastx_record_symbol_count(uint64_t bases) noexcept
cuda::std::unexpected< Error > Err(Error error)
Failure return; converts to any Result<T> via cuda::std::unexpected.
static constexpr uint64_t symbolWidth
Input bytes per symbol.
static Error io(std::string message)
static Error resource(std::string message)
Fallible API result: cuda::std::expected<T, Error> with cuSBF factories.
Driver-reported free device memory (bytes available for new allocations).
size_t free_bytes
Bytes reported free by cudaMemGetInfo.