원클릭으로
convert-xtensor-to-qnn
Convert xtensor prototype code to production QNN direct-buffer operations (zero-copy)
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Convert xtensor prototype code to production QNN direct-buffer operations (zero-copy)
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Add a new LLM model to the geniex runtime (creates spec header, example executable, CMakeLists)
Reference for developing against the QAIRT/QNN runtime — graph execution, KV cache, tensor I/O, multi-shard wiring
Write C++ tensor logic using xtensor (NumPy-like API) for prototyping before QNN conversion
| name | convert-xtensor-to-qnn |
| description | Convert xtensor prototype code to production QNN direct-buffer operations (zero-copy) |
| allowed-tools | Read, Edit, Write, Bash |
Convert xtensor-based prototype code to direct QNN buffer operations for production. This eliminates the extra memory copy that xtensor introduces.
| xtensor | QNN equivalent |
|---|---|
xt::xarray<T> | Raw pointer + shape metadata |
xt::view(arr, range) | Offset calculation into shared buffer |
xt::zeros<T>({...}) | memset(ptr, 0, size) |
xt::ones<T>({...}) | Loop initialization |
xt::adapt(ptr, shape) | Direct pointer use (already zero-copy) |
xt::eval(expr) | Materialize into pre-allocated buffer |
// Read from graph output
float* output_ptr = static_cast<float*>(graph.outputPtr("tensor_name"));
// Write to graph input
float* input_ptr = static_cast<float*>(graph.inputPtr("tensor_name"));
// Using Graph API (handles dtype conversion: float32, float16, ufixed8/16, int32)
graph.write("tensor_name", float_data_ptr);
graph.read("tensor_name", float_output_ptr);
QNN uses row-major (C-style) layout, same as xtensor default.
For 2D tensor X[rows][cols]:
X[0,0], X[0,1], ..., X[0,cols-1], X[1,0], X[1,1], ...
ARN (prefill) and AR1 (decode) graphs share input/output buffers since they never run concurrently. Modifying one graph's input buffer affects the other.
Expand (2x2 → 2x3): Process last row to first (move backward), zero-pad new positions.
Shrink (2x3 → 2x2): Process first row to last (move forward), compact memory.
| Scenario | Use |
|---|---|
| Initial prototyping | xtensor |
| Debugging complex logic | xtensor |
| Production deployment | QNN tensors |
| Performance-critical paths | QNN tensors |
| One-off preprocessing | xtensor (acceptable overhead) |
graph.inputPtr() / graph.outputPtr()memset for zero-initialization, memcpy for block copies