vllm.model_executor.layers.mamba.ops.cpu.gdn_attention ¶
Functions:
-
cpu_gdn_attention_core–CPU custom op for the core GDN attention computation.
-
cpu_gdn_attention_core_fake–Fake implementation for torch.compile.
_conv_buffer_view(layer) ¶
Return the conv-state cache as (num_slots, dim, state_len).
Source code in vllm/model_executor/layers/mamba/ops/cpu/gdn_attention.py
_spec_aware_nonspec(layer, attn_metadata_i, mixed_qkv, b, a, core_attn_out, conv_buf, ssm_state, width) ¶
Non-spec prefill/decode with a wide conv buffer (torch path).
Source code in vllm/model_executor/layers/mamba/ops/cpu/gdn_attention.py
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
_spec_aware_nonspec_subset(layer, attn_metadata_i, mixed_qkv, b, a, conv_buf, ssm_state, width) ¶
Process non-spec (prefill) tokens that coexist with spec sequences.
Returns outputs ordered like non_spec_token_indx.
Source code in vllm/model_executor/layers/mamba/ops/cpu/gdn_attention.py
_spec_forward(layer, attn_metadata_i, mixed_qkv_spec, b_spec, a_spec, conv_buf, ssm_state, width, state_len) ¶
Run the GDN core for the multi-query (speculative) tokens.
Returns the core attention output for the spec tokens, in the same token order as mixed_qkv_spec (i.e. ordered by spec_query_start_loc).
Source code in vllm/model_executor/layers/mamba/ops/cpu/gdn_attention.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | |
_unpacked_conv_weight(layer) ¶
Return the plain (dim, width) conv weight.
On AMX the conv1d weight is VNNI-packed in place at load time (only usable by the AMX C++ kernel), so the torch spec-decode path relies on the un-packed copy stashed by dispatch_cpu_unquantized_gemm.
Source code in vllm/model_executor/layers/mamba/ops/cpu/gdn_attention.py
cpu_gdn_attention_core(mixed_qkv, b, a, core_attn_out, layer_name) ¶
CPU custom op for the core GDN attention computation.
Source code in vllm/model_executor/layers/mamba/ops/cpu/gdn_attention.py
cpu_gdn_attention_core_fake(mixed_qkv, b, a, core_attn_out, layer_name) ¶
Fake implementation for torch.compile.