Files
leleka/scripts/cuda-stubs/cooperative_groups.h
T
Pavlo RatushnyiandClaude Sonnet 5.5 2ab3a8ca48 test(cuda): run the stub pass through clang's CUDA frontend (host/device call legality, __shared__ rules, <<<>>>); fix qsa variants block_q4_0 packing, de-duplicate native_head_native.cu
- check-cu.py now defaults to clang -x cuda --cuda-host-only with real qualifiers; --plain keeps the C++-only pass.
- qsa_prompt_attention_variants.cu: block_q4_0 under pack(1) as in kv_q4.hpp (cu_pin refreshed).
- native_head_native.cu: orphan copy had __launch_bounds__ before extern "C" __global__ (never nvcc-built); now the sealed twin's text.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 16:56:45 +02:00

26 lines
1.4 KiB
C++

// Stub of <cooperative_groups.h>: thread_block / tiled_partition / this_thread_block / reduce.
#pragma once
#include "cuda_stub.h"
#if defined(__CUDA__)
#pragma clang force_cuda_host_device begin
#endif
namespace cooperative_groups {
struct thread_block {
void sync() const; unsigned thread_rank() const; unsigned size() const; dim3 group_index() const; uint3 thread_index() const; dim3 group_dim() const;
};
inline thread_block this_thread_block() { return thread_block{}; }
template <unsigned N> struct thread_block_tile {
void sync() const; unsigned thread_rank() const; unsigned size() const; unsigned meta_group_rank() const; unsigned meta_group_size() const;
template <class T> T shfl(T, int) const; template <class T> T shfl_down(T, unsigned) const; template <class T> T shfl_up(T, unsigned) const;
template <class T> T shfl_xor(T, unsigned) const; int any(int) const; int all(int) const; unsigned ballot(int) const;
};
template <unsigned N> thread_block_tile<N> tiled_partition(const thread_block&) { return {}; }
template <class G> struct plus { template <class T> T operator()(T a, T b) const { return a + b; } };
template <class T> struct maximum { T operator()(T a, T b) const { return a > b ? a : b; } };
template <class T> struct less { T operator()(T a, T b) const { return a < b ? a : b; } };
template <class G, class T, class Op> T reduce(const G&, T v, Op) { return v; }
}
#if defined(__CUDA__)
#pragma clang force_cuda_host_device end
#endif