Repository navigation
Commit 05a88d9
authored
Support compiled string vocabulary comparison and alignment (#1230)
# Summary
> Fix three compilation failures in string-category comparison and
alignment.
# Description of the change
> Found while compiling KumoTabular's default recipe on PyTorch
2.10–2.14:
```python
model.fit(x, y)
predict = torch.compile(model.predict, backend="inductor", fullgraph=False)
predict(x_query)
```
> | Failure point | Error | Fix |
> |---|---|---|
> | String equality reads `valid` / `data_offset` properties during
tracing | `DataDependentOutputException:
aten._local_scalar_dense.default` | Call SDM's equality implementation
directly and use shared functions instead of property access. |
> | String concatenation reads `data_offset` during tracing | Same
scalar-extraction error | Call the same data/offset function directly. |
> | Tracing reaches the external vocabulary join | `RuntimeError:
.numpy() is not supported for tensor subclasses.` | Register the
existing lookup as one custom operation, with output shape defined for
compilation. |
>
> Packing/unpacking is supporting code: pass ordinary tensors into the
custom operation, then reconstruct string views inside it. StringTensor
does not dispatch this operation directly. Existing Arrow/cuDF joins,
public properties, missing values and unknown-category code `-1` are
preserved.
# Validation
> CPU Inductor, Python 3.12; default recipe with four estimators, mixed
Iris data, reduced model and synthetic weights.
>
> | Check | Result |
> |---|---|
> | Focused suites, PyTorch 2.10–2.14 | Passed |
> | Compiled default `fit` / `predict` / uncached `model()`, fresh
caches | Pass on all five; maximum eager difference 2.98e-8 |
> | Strict string lookup | Covered cases pass on 2.11–2.14; 2.10 sliced
inputs remain blocked |
>
> Equality still requires graph breaks; this does not establish
full-method `fullgraph=True` support. Separate 2.13 compiler-cache reuse
checks can raise `RecursionError`.
>
> Additional PyTorch 2.14/L4 testing uses the full pretrained model and
default recipe: compiled `fit`/`predict` execute, but BF16 numerical
parity is not established. Uncached `model()` also needs the separate
metadata-guard fix. cuDF was unavailable; joins used Arrow.1 parent baba30e commit 05a88d9
4 files changed
Lines changed: 228 additions & 76 deletions
File tree
- sdm
- processing/categorical
- tensor
- test
- processing/categorical
- tensor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
388 | 353 | | |
389 | | - | |
390 | 354 | | |
391 | | - | |
| 355 | + | |
392 | 356 | | |
393 | 357 | | |
394 | 358 | | |
| |||
535 | 499 | | |
536 | 500 | | |
537 | 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 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
502 | 509 | | |
503 | 510 | | |
504 | 511 | | |
505 | 512 | | |
506 | 513 | | |
507 | 514 | | |
508 | 515 | | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
| 516 | + | |
524 | 517 | | |
525 | 518 | | |
526 | 519 | | |
| |||
530 | 523 | | |
531 | 524 | | |
532 | 525 | | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
| 526 | + | |
542 | 527 | | |
543 | 528 | | |
544 | 529 | | |
| |||
611 | 596 | | |
612 | 597 | | |
613 | 598 | | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
614 | 606 | | |
615 | 607 | | |
616 | 608 | | |
| |||
1007 | 999 | | |
1008 | 1000 | | |
1009 | 1001 | | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
1010 | 1032 | | |
1011 | 1033 | | |
1012 | 1034 | | |
1013 | 1035 | | |
1014 | 1036 | | |
1015 | 1037 | | |
1016 | 1038 | | |
1017 | | - | |
| 1039 | + | |
1018 | 1040 | | |
1019 | 1041 | | |
1020 | 1042 | | |
| |||
1032 | 1054 | | |
1033 | 1055 | | |
1034 | 1056 | | |
1035 | | - | |
1036 | | - | |
| 1057 | + | |
| 1058 | + | |
1037 | 1059 | | |
1038 | 1060 | | |
1039 | 1061 | | |
| |||
1332 | 1354 | | |
1333 | 1355 | | |
1334 | 1356 | | |
1335 | | - | |
| 1357 | + | |
1336 | 1358 | | |
1337 | 1359 | | |
1338 | 1360 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
504 | 504 | | |
505 | 505 | | |
506 | 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
487 | 497 | | |
488 | 498 | | |
489 | 499 | | |
| |||
0 commit comments