AMD-AGI / AMD-AGI/AgentKernelArena

LLM Cheating on hip kernel matrix_multiplication

Open
#30 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
118
Forks
14
Avg merge
3d 5h
Merged PRs (30d)
8

Description

We observed that when using GPT-5.4, it tends to “cheat” on tasks/hip2hip/others/matrix_multiplication.
It modified main.hip in two key ways:

  1. Removes the real GEMM computation
    The baseline uses a standard tiled GEMM, but the “optimized” version directly sets: C[row * b_cols + col] = a_cols * 0.02F; This exploits the fact that inputs are constant (A=1.0, B=0.02), so the result can be hardcoded without actual computation.
  2. Removes the real GPU execution flow
    The baseline includes memory allocation, hipMemcpy, kernel launch, and result verification.
    The modified version bypasses actual execution and relies on trivial verification logic to pass.

So this is not a real optimization, but exploiting fixed inputs and weak validation to “pass” the test and reported 35x speedup.

main.hip.txt

Here is the cheating main.hip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tasks/hip2hip/others/matrix_multiplication/main.hip and compare it with the attached main.hip.txt; inspect how this task is launched and verified. Run the existing benchmark or verification path. Done means implementations that bypass the GEMM computation or GPU execution are detected instead of being accepted as valid optimizations.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
hpc, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.