Skip to content

English · Español

Fase 24 — Cuestionarios (espejo)

🇪🇸 Las preguntas canónicas viven en data/quizzes/phase-24-cuda-triton.yaml.


q-24-01 — Cuándo CUDA gana a Triton

Enunciado (EN): Which of the following is a case where raw CUDA is preferable to Triton?

  • A. Implementing a vector-add with stride 1.
  • B. A simple block matmul.
  • C. Warp specialization (different warps in a block playing different roles).
  • D. Quick prototyping of a new attention variant.

Correcta: C. La warp specialization requiere control sobre qué hilos del bloque hacen qué; las abstracciones vectoriales de Triton asumen uniformidad de warp. Las otras tres son justo los casos donde gana la abstracción de tile de Triton.


q-24-02 — Desbordamiento de shared memory

Enunciado (EN): A CUDA kernel writes tile[threadIdx.y][15] but tile is declared __shared__ float tile[16][15]. What happens?

  • A. The compiler rejects the kernel.
  • B. Runtime raises CUDA_ERROR_ILLEGAL_ADDRESS on the OOB write.
  • C. The write silently corrupts the next shared-memory allocation in the kernel.
  • D. The kernel silently produces correct output (the GPU pads).

Correcta: C. CUDA no comprueba los límites de la shared memory en tiempo de ejecución. La escritura OOB corrompe lo que venga después en el layout de shared memory del bloque.


q-24-03 — Diagnóstico de bugs de shared-mem

Enunciado (EN): In one or two sentences, name the tool you would use to catch a silent shared-memory OOB write in a CUDA kernel, and what the tool reports.

Respuesta libre. Menciones esperadas: compute-sanitizer (o cuda-memcheck); reporta "Invalid shared write of size N at...".


q-24-04 — Estratificación construir-antes-de-abstraer

Enunciado (EN): Select every statement that correctly characterizes the layering of GPU programming abstractions per CLAUDE.md §0.1.

  • A. NumPy / hand-written kernels come before CUDA.
  • B. CUDA comes before Triton.
  • C. Triton comes before PyTorch's torch.nn.functional.
  • D. PyTorch's high-level modules come before NumPy.

Correctas: A, B, C. Cada capa solo tiene sentido si la capa inferior se practicó primero.


q-24-05 — Auto-tuning del block-size en Triton

Enunciado (EN): A Triton kernel declares BLOCK_SIZE: tl.constexpr and is auto-tuned over [64, 128, 256]. What does this mean for the compiled kernel?

  • A. The runtime picks BLOCK_SIZE based on input size on every call.
  • B. Triton emits three specialized kernels; one is selected based on auto-tuning at first call.
  • C. BLOCK_SIZE is a runtime parameter passed in by the host.
  • D. The compiler picks one value at compile time and never reconsiders.

Correcta: B. Los parámetros tl.constexpr se hornean en el kernel compilado; se generan varias especializaciones para el conjunto de auto-tune y la más rápida se selecciona en la primera invocación.