Guide-linked quiz · Medium Level

Triton Language for Custom GPU Kernels Quiz

Review Triton's block-level kernel model, masked boundary handling, launch configuration and the need for measured performance validation.

Question 1 of 8

How does Triton describe much GPU work compared with a thread-by-thread CUDA kernel?

Preview every question8 questions

Answers and explanations appear as you take the quiz.

  1. How does Triton describe much GPU work compared with a thread-by-thread CUDA kernel?
    • As operations over logical blocks of elements
    • As a single CPU instruction for the full tensor
    • As one kernel per individual value
    • As a SQL query over GPU memory
  2. Why do vector kernels mask their final block?
    • To force the last tile to launch fewer warps
    • To prevent loads or stores beyond the valid tensor extent
    • To pad the underlying tensor until its length is divisible by the block size
    • To skip the entire final program instance when a partial block remains
  3. What does tl.program_id commonly identify?
    • The GPU device ordinal that compiled the function
    • The total number of warps in a program instance
    • The index of the active logical program instance in the launch grid
    • The element offset produced by tl.arange within that instance
  4. Why can a tiled matrix kernel reduce memory traffic?
    • It reduces the mathematical number of output elements
    • It eliminates every global-memory access
    • It makes all matrices contiguous automatically
    • It reuses loaded values across multiple calculations
  5. What should a benchmark do with JIT compilation time?
    • Count compilation as device execution only
    • Separate first-call compilation from steady-state kernel runtime
    • Exclude all warmup and synchronization unconditionally
    • Assume every shape uses the same compiled binary
  6. Why might a Triton kernel be slower than a library operation?
    • Custom kernels cannot use memory tiling
    • Triton always executes on a CPU
    • The library may already use optimized kernels and launch overhead can dominate
    • GPU kernels never benefit from fusion
  7. What can change numerical results between Triton and a reference implementation?
    • The number of code comments
    • The order of Python imports only
    • The tensor's file name
    • Floating-point operation order and precision
  8. When is a custom Triton kernel most defensible?
    • Profiling identifies a bottleneck and a specialized operation can justify maintenance
    • Before measuring any baseline
    • Whenever a tensor contains more than one value
    • When correctness tests are unavailable

Keep testing yourself

More quizzes picked for your level.

View all quizzes