Skip to content

Instantly share code, notes, and snippets.

View lhl's full-sized avatar

Leonard lhl

View GitHub Profile
@lhl
lhl / README.md
Created July 16, 2026 09:12
gfx1151 silent 128K HIP queue-retirement stall: redacted HQD/MES evidence (2026-07-16, hipEngine 35d3d0e7)

gfx1151 silent 128K queue-retirement stall — redacted evidence bundle

Created: 2026-07-16 Public hipEngine capture commit: https://github.com/shisa-ai/hipEngine/commit/35d3d0e7 Compact artifact: https://github.com/shisa-ai/hipEngine/blob/35d3d0e7/benchmarks/results/2026-07-16-gfx1151-128k-mes-kfd-stall-capture.json Full investigation: https://github.com/shisa-ai/hipEngine/blob/35d3d0e7/docs/DEBUG-GFX1151-STALL.md

Headline

The first 128K prefill on the MES-debug boot stopped retiring same-stream work at submitted/completed cursor 389/339. During the final 175 seconds, all 36 telemetry samples remained at 100% reported activity and 2.9 GHz with 41–49 W package power and fixed residency. One established-stall HQD dump found the primary 1 MiB AQL queue active and non-empty at rptr=0x32250 and wptr=0x32450 (32 unread AQL packets after the gfx11 four-bit AQL pointer shift), with CP_HQD_ERROR=0 and CP_HQD_DEQUEUE_REQUEST=0. No amdgpu/KFD fault, timeout, autonomous SIGTERM, recovery, or reset occurred.

@lhl
lhl / supply-chain-security.md
Last active October 31, 2026 06:07
Supply Chain Security for Software Developers - practical layered defenses after the 2026 TeamPCP campaign (Trivy/LiteLLM/axios)

Supply Chain Security for Software Developers

Practical, layered defenses against package supply chain attacks. Written after the March–April 2026 wave of supply chain compromises: Trivy and LiteLLM (TeamPCP), and axios (Sapphire Sleet / UNC1069).

What Happened

Three major supply chain attacks hit within two weeks, exposing how fragile implicit trust in open-source tooling can be.

Trivy (TeamPCP, March 19–22): Aqua Security's Trivy vulnerability scanner — the most widely used open-source scanner in cloud-native CI/CD — was compromised in a multi-phase attack. An earlier breach in February via a misconfigured pull_request_target workflow stole a Personal Access Token. Credential

ANALYSIS: IronClaw — NEAR AI's Rust Rewrite of OpenClaw

Date: 2026-03-29

Reference snapshot: reference/ironclaw/ (branch: staging, tip ≈ 2026-03-29)

Prior art: See ANALYSIS-openclaw-followon-2026-03-27.md and docs/_dev/v0.3/ANALYSIS-v0.1-vs-openclaw.md for the TypeScript OpenClaw baseline.

Security framework: Comparison grounded in ANALYSIS-shisad-security-design-analysis.md (shisad security gap analysis) and ~/agentic-security/ANALYSIS.md (78-paper survey with 5-layer defense stack taxonomy).

@lhl
lhl / JA-MT-Harness-vs-Swallow-Evaluation.md
Last active December 19, 2025 10:30
Analysis of difference between JA MT-Bench Tests

This is a comparison between https://github.com/shisa-ai/ja-mt-bench-harness which aims to be faithful to the original JA MT-Bench and the version that is used in Swallow Evalulation Instruct v202510 https://github.com/swallow-llm/swallow-evaluation-instruct/releases/tag/v202510

JA-MT-Harness vs Swallow-Evaluation (JA MT-Bench)

High-level summary

The two frameworks both use an OpenAI-compatible API, but they run and score JA MT‑Bench in materially different ways. The FastChat-based harness is closer to the original MT‑Bench pipeline (question file layout, judge prompts, and single-sample judging), while Swallow’s lighteval task intentionally modifies the evaluation: Japanese-enforced judge prompts, a Japanese system prompt for model generation, multi-sample averaging (N=5), output truncation by character length, different judge model, and additional metrics. These differences alone can easily move scores by multiple points.

Key takeaways:

  • Prompting and judging are different (language constraint
@lhl
lhl / ANALYSIS-gpus.md
Created October 24, 2025 06:56
Codex 5 High analysis of GGML CUDA paths

GGML CUDA/HIP Inference Paths and Precision by Architecture

This document summarizes how ggml’s CUDA/HIP backend executes inference on different GPU families, which code paths are used, and at what numeric precision the major compute happens. It also provides rough workload composition percentages to relate paths to each architecture’s FLOPS/TOPs.

References are to files under ggml/src/ggml-cuda unless noted.

  • Matmul (quantized): mmq.cu, mmq.cuh, vecdotq.cuh, quantize.cu/.cuh
  • Matmul (float): mmf.cu, mmvf.cu, cuBLAS/hipBLAS calls in ggml-cuda.cu
  • FlashAttention: fattn*.cu/.cuh
  • Softmax: softmax.cu
@lhl
lhl / power-usage.py
Created January 13, 2025 05:58
2025-01 vLLM/Llama 3.3 70B FP8 tokens/joule
# Power Usage Calculator for AI Workloads
'''
# Serving
$ vllm serve meta-llama/Llama-3.3-70B-Instruct --tensor-parallel-size 4 --num-scheduler-steps 20 --quantization=fp8 --gpu-memory-utilization=0.97
INFO 01-13 04:59:05 api_server.py:712] vLLM API server version 0.6.6.post2.dev5+g5ce4627a
# Benchmark - we do bs=64 to emulate https://arxiv.org/pdf/2310.03003
cmd = [
"python", os.path.expanduser("~/vllm/benchmarks/benchmark_serving.py"),
@lhl
lhl / HOWTO.md
Last active July 19, 2018 12:22
How to configure NGINX with LetsEncrypt using the simp_le client

How to configure NGINX with LetsEncrypt using the simp_le client.

this includes the nginx configs, as well as the auto renewal steps. I took a bunch of these steps from this blog, and adapted it to how I like.

simp_le issues three return codes depending on the status of the request.

  • 0 if certificate data was created or updated;
  • 1 if renewal not necessary;
  • 2 in case of errors.
! http://crunchbang.org/forums/viewtopic.php?id=5618
! Xft.dpi: 110
Xft.dpi: 96
Xft.autohint: 0
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb
@lhl
lhl / DAMP.ahk
Last active August 29, 2015 14:10
AutoHotKey for DAI MP
/*
Dragon Age Inquisition Multiplayer Key Bindings
---
You should map WASD (from WQSE to movement).
These tweaks should make DAI easier to control.
What the script does:
* MB4 toggles RMB down/up (freelook)
* Caps lock toggles sprint

Keybase proof

I hereby claim:

  • I am lhl on github.
  • I am lhl (https://keybase.io/lhl) on keybase.
  • I have a public key whose fingerprint is 4DAB 5922 AD2C B6F2 780C CC2A CE9A 69D9 663F C373

To claim this, I am signing this object: