Skip to content

Wrap exceptions in std::exception to verbose output on exception. - #1316

Merged
prusnak merged 1 commit into
ggml-org:masterfrom
ivanstepanovftw:stdexception
May 4, 2023
Merged

prusnak merged 1 commit into
ggml-org:masterfrom
ivanstepanovftw:stdexception

Conversation

@ivanstepanovftw

Copy link
Copy Markdown
Contributor

I am not getting errors thrown as std::string.

Before:

William Safire will walk us through the nuances of badterminate called after throwing an instance of 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >'

After:

William Safire will walk us through the nuances of badterminate called after throwing an instance of 'std::runtime_error'
  what():  failed to open session/7B/hello.bin: No such file or directory

@prusnak
prusnak merged commit 34d9f22 into ggml-org:master May 4, 2023
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
bong-water-water-bong added a commit to 1bit-MONSTER/llama.cpp that referenced this pull request Nov 7, 2026
…atively (engine ggml-org#1316)

A tied token embedding is gathered by GET_ROWS and contracted by the output MUL_MAT. The contraction asks for a packed row
layout, so one value is read in two layouts by one command program - and a program holds one binding per value
(CommandProgramBindings::find(ValueId)), so the executor refuses it: "weight value 0 has conflicting resident layout
requests", llama_decode ret = -3. That is why moving the input layer onto the device
(LLAMA_INPUT_LAYER_ON_DEV=1, src/llama-model.cpp:1372) has never worked for a tied embedding, and why the input layer
stays on the CPU and costs one node plus one split per graph.

The dispatch registry now declines a match that requests a packed layout of a weight another node gathers natively, so the
next registration for the same root op - the native-format one - takes the node and both consumers share one resident copy.

Scoped to device-resident weights: the conflict needs both readers to want a resident binding, which only happens when the
weight is already on the device. With the weight in a host buffer - the default, input layer on the CPU - the gate cannot
fire, so the shipped path is structurally unchanged rather than unchanged in one box state (measured: default path 309.5
t/s median with the gate, 309.6 without, three repeats each).

GGML_HRX_LAYOUT_CONFLICT_NO_PACK=0 restores the previous behaviour and is the A/B control.

Measured at 0.6B, -dev HRX0 -ngl 99 -c 512, no-SVM trio: LLAMA_INPUT_LAYER_ON_DEV=1 with GGML_HRX_STRICT=1 now exits 0 with no
node off HRX (3/3 runs; the pin aborts with ret=-3), while the same arm with the gate off still refuses the program (3/3).
bong-water-water-bong added a commit to 1bit-MONSTER/llama.cpp that referenced this pull request Nov 7, 2026
…atively (engine ggml-org#1316)

A tied token embedding is gathered by GET_ROWS and contracted by the output MUL_MAT. The contraction asks for a packed row
layout, so one value is read in two layouts by one command program - and a program holds one binding per value
(CommandProgramBindings::find(ValueId)), so the executor refuses it: "weight value 0 has conflicting resident layout
requests", llama_decode ret = -3. That is why moving the input layer onto the device
(LLAMA_INPUT_LAYER_ON_DEV=1, src/llama-model.cpp:1372) has never worked for a tied embedding, and why the input layer
stays on the CPU and costs one node plus one split per graph.

The dispatch registry now declines a match that requests a packed layout of a weight another node gathers natively, so the
next registration for the same root op - the native-format one - takes the node and both consumers share one resident copy.

Scoped to device-resident weights: the conflict needs both readers to want a resident binding, which only happens when the
weight is already on the device. With the weight in a host buffer - the default, input layer on the CPU - the gate cannot
fire, so the shipped path is structurally unchanged rather than unchanged in one box state (measured: default path 309.5
t/s median with the gate, 309.6 without, three repeats each).

GGML_HRX_LAYOUT_CONFLICT_NO_PACK=0 restores the previous behaviour and is the A/B control.

Measured at 0.6B, -dev HRX0 -ngl 99 -c 512, no-SVM trio: LLAMA_INPUT_LAYER_ON_DEV=1 with GGML_HRX_STRICT=1 now exits 0 with no
node off HRX (3/3 runs; the pin aborts with ret=-3), while the same arm with the gate off still refuses the program (3/3).
bong-water-water-bong added a commit to 1bit-MONSTER/llama.cpp that referenced this pull request Nov 7, 2026
…atively (engine ggml-org#1316) (#233)

A tied token embedding is gathered by GET_ROWS and contracted by the output MUL_MAT. The contraction asks for a packed row
layout, so one value is read in two layouts by one command program - and a program holds one binding per value
(CommandProgramBindings::find(ValueId)), so the executor refuses it: "weight value 0 has conflicting resident layout
requests", llama_decode ret = -3. That is why moving the input layer onto the device
(LLAMA_INPUT_LAYER_ON_DEV=1, src/llama-model.cpp:1372) has never worked for a tied embedding, and why the input layer
stays on the CPU and costs one node plus one split per graph.

The dispatch registry now declines a match that requests a packed layout of a weight another node gathers natively, so the
next registration for the same root op - the native-format one - takes the node and both consumers share one resident copy.

Scoped to device-resident weights: the conflict needs both readers to want a resident binding, which only happens when the
weight is already on the device. With the weight in a host buffer - the default, input layer on the CPU - the gate cannot
fire, so the shipped path is structurally unchanged rather than unchanged in one box state (measured: default path 309.5
t/s median with the gate, 309.6 without, three repeats each).

GGML_HRX_LAYOUT_CONFLICT_NO_PACK=0 restores the previous behaviour and is the A/B control.

Measured at 0.6B, -dev HRX0 -ngl 99 -c 512, no-SVM trio: LLAMA_INPUT_LAYER_ON_DEV=1 with GGML_HRX_STRICT=1 now exits 0 with no
node off HRX (3/3 runs; the pin aborts with ret=-3), while the same arm with the gate off still refuses the program (3/3).

Co-authored-by: bong-water-water-bong <[email protected]>
bong-water-water-bong added a commit to 1bit-MONSTER/llama.cpp that referenced this pull request Nov 12, 2026
…ngine ggml-org#2137) (#325)

#324 hands a 2-to-8-token batch to the packed prefill kernels when prefill
reads the weight packed. A weight a GET_ROWS also reads (a tied token
embedding, engine ggml-org#1316) is never packed: prefill reads it stored through
weight_has_native_layout_reader, so declining the kquant kernel only moved
the batch to the stored f32 WMMA kernel. Same clause as the conv4 matcher
(#322). Asked in review on #324.

Two host rows (Q4_K, 6 and 8 tokens) fail without the clause.

Co-authored-by: bong-water-water-bong <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
bong-water-water-bong pushed a commit to 1bit-MONSTER/llama.cpp that referenced this pull request Nov 13, 2026
…and a brace that belongs to ours

Hunk 1 was not a conflict of choice at all: our 167-line debug-switch block (GGML_HRX_DISABLE_DISPATCH / GGML_HRX_LOG_DISPATCH) and AMD's
three-line dispatch_weight_layout_eligible() happened to occupy the same place. Both are wanted. Concatenating them, though, produced a
function defined inside a function, because the `}` that ends the hunk closes OUR block -- ours ends mid-body with "return false;" and the
brace after the hunk is its terminator, so AMD's function has to be moved BELOW that brace, and needs a closing brace of its own that the hunk
text does not carry (theirs was written to be followed by ours' brace).

Hunk 2 is a genuine choice and it goes to ours: our version keeps the engine ggml-org#1316 packed-layout reset AND the covered-output accounting
(diagnostics attempts, fusion_order_accepts); AMD's three-line form is "matched && dispatch_has_eligible_weight_layouts" and would drop both.
Keeping the helper available costs nothing, and the ggml-org#1316 fix is a correctness item, so the merge does not get to lose it.

Verified: the TU compiles with no diagnostics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants