fix(build): c10::optional for CoreX CUDA 10.2 — std::optional incompatible

CoreX PyTorch uses c10::optional, not std::optional. The forward-declared
ixformer::infer signatures must match the actual .so ABI.
This commit is contained in:
Claude
2026-08-14 01:49:25 +00:00
parent 1d9b620416
commit 56fe58ada3
2 changed files with 21 additions and 21 deletions

View File

@@ -46,9 +46,9 @@ torch::Tensor ixinfer_flash_attn_unpad_with_block_tables(
double scale,
double softcap,
bool sqrt_alibi,
const std::optional<torch::Tensor>& alibi_slopes,
const std::optional<torch::Tensor>& sinks,
std::optional<torch::Tensor>& lse);
const c10::optional<torch::Tensor>& alibi_slopes,
const c10::optional<torch::Tensor>& sinks,
c10::optional<torch::Tensor>& lse);
torch::Tensor xllm_paged_attention(
torch::Tensor& out,
@@ -61,14 +61,14 @@ torch::Tensor xllm_paged_attention(
torch::Tensor& context_lens,
int64_t block_size,
int64_t max_context_len,
const std::optional<torch::Tensor>& alibi_slopes,
const c10::optional<torch::Tensor>& alibi_slopes,
bool causal,
int32_t window_left,
int32_t window_right,
double softcap,
bool enable_cuda_graph,
bool use_sqrt_alibi,
const std::optional<torch::Tensor>& sinks);
const c10::optional<torch::Tensor>& sinks);
// --- Activation ---
void silu_and_mul(torch::Tensor& input, torch::Tensor& output);
@@ -77,9 +77,9 @@ void silu_and_mul(torch::Tensor& input, torch::Tensor& output);
torch::Tensor ixformer_linear(torch::Tensor& input,
torch::Tensor& weight,
int64_t act_type,
const std::optional<torch::Tensor>& bias,
const std::optional<torch::Tensor>& out,
const std::optional<bool> persistent);
const c10::optional<torch::Tensor>& bias,
const c10::optional<torch::Tensor>& out,
const c10::optional<bool> persistent);
torch::Tensor ixformer_linear_ex(torch::Tensor& input,
torch::Tensor& weight,
@@ -109,7 +109,7 @@ void residual_rms_norm(torch::Tensor& input,
torch::Tensor& weight,
torch::Tensor& output,
torch::Tensor& residual_output,
const std::optional<torch::Tensor>& fused_bias,
const c10::optional<torch::Tensor>& fused_bias,
double alpha,
double eps,
bool is_post);
@@ -117,7 +117,7 @@ void residual_rms_norm(torch::Tensor& input,
void rms_norm(torch::Tensor& input,
torch::Tensor& weight,
torch::Tensor& output,
const std::optional<torch::Tensor>& fused_bias,
const c10::optional<torch::Tensor>& fused_bias,
double eps);
// --- MoE ---
@@ -261,7 +261,7 @@ torch::Tensor ix_flash_attn_prefill(
int64_t max_query_len, int64_t max_seq_len,
double scale, bool is_causal,
int64_t window_left, int64_t window_right) {
std::optional<torch::Tensor> lse = std::nullopt;
c10::optional<torch::Tensor> lse = std::nullopt;
return ixformer::infer::ixinfer_flash_attn_unpad_with_block_tables(
query, key_cache, value_cache, output, block_tables,
cu_seq_q, cu_seq_k, max_query_len, max_seq_len,

View File

@@ -17,7 +17,7 @@
#include <vector>
#include <optional>
static const std::optional<torch::Tensor> kNoneTensor = {};
static const c10::optional<torch::Tensor> kNoneTensor = {};
// Forward-declare ixformer C++ API (from base image SDK)
namespace ixformer {
@@ -34,9 +34,9 @@ void moe_compute_token_index_api(
torch::Tensor& src_dst,
torch::Tensor& dst_src,
torch::Tensor& expert_sizes_gpu,
const std::optional<torch::Tensor>& expert_mask,
const std::optional<torch::Tensor>& expert_sizes_cpu,
const std::optional<torch::Tensor>& expand_tokens_gpu,
const c10::optional<torch::Tensor>& expert_mask,
const c10::optional<torch::Tensor>& expert_sizes_cpu,
const c10::optional<torch::Tensor>& expand_tokens_gpu,
int64_t start_expert_id,
int64_t end_expert_id,
int64_t num_experts);
@@ -44,7 +44,7 @@ void moe_compute_token_index_api(
void moe_expand_input(torch::Tensor outputs,
torch::Tensor inputs,
torch::Tensor dst_to_src,
const std::optional<torch::Tensor>& src_to_dst,
const c10::optional<torch::Tensor>& src_to_dst,
int64_t dst_tokens,
int64_t expand_factor);
@@ -52,17 +52,17 @@ void moe_w16a16_group_gemm(torch::Tensor output,
torch::Tensor inputs,
torch::Tensor weights,
torch::Tensor tokens_per_experts,
const std::optional<torch::Tensor>& dst_to_src,
const std::optional<torch::Tensor>& bias,
const c10::optional<torch::Tensor>& dst_to_src,
const c10::optional<torch::Tensor>& bias,
std::string format,
int64_t persistent,
int64_t output_n);
void moe_output_reduce_sum(torch::Tensor outputs,
torch::Tensor inputs,
const std::optional<torch::Tensor>& mul_weight,
const std::optional<torch::Tensor>& mask,
const std::optional<torch::Tensor>& extra_residual,
const c10::optional<torch::Tensor>& mul_weight,
const c10::optional<torch::Tensor>& mask,
const c10::optional<torch::Tensor>& extra_residual,
double scaling_factor);
void silu_and_mul(torch::Tensor& input, torch::Tensor& output);