Commit 9c45ef7
Allow operators to be called outside of the kernel registry
Summary:
Usecase from Whatsapp (D67169920) to:
- use dtype selective build to create executorch_generated_lib
- use portable lib operators directly in C++
- ^cover these usecases in the same dependency
This requires removing the compiler flag '-fvisibility=hidden', so that the operator symbols are exposed in the archive file. Otherwise, we get missing operator symbols, like in P1697209425.
Alternative solution 1:
Add the operator dependency explicitly, eg. adding `//executorch/kernels/portable/cpu:op_cat`, to the dep list, to allow C++ usage.
This causes duplicate symbols for dependencies in op_cat, because dtype selective build re-builds the portable lib.
Without dtype selective build, this would be OK, as we use `//executorch/kernels/portable:operators` that aggregates the individual operator targets under the hood; this would be deduplicated with the explicit operator dependency.
Alternative solution 2:
Expose the operator registry and add a helper utility to return the function ptr to the kernel, though this could be an intrusive change that opens operator registry to external clients outside the core runtime. cc tarun292.
Differential Revision: D672290961 parent 7924942 commit 9c45ef7
1 file changed
+19
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
| 370 | + | |
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
392 | 406 | | |
393 | 407 | | |
394 | 408 | | |
| |||
398 | 412 | | |
399 | 413 | | |
400 | 414 | | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
| 415 | + | |
411 | 416 | | |
412 | 417 | | |
413 | 418 | | |
| |||
440 | 445 | | |
441 | 446 | | |
442 | 447 | | |
443 | | - | |
| 448 | + | |
| 449 | + | |
444 | 450 | | |
445 | 451 | | |
446 | 452 | | |
| |||
584 | 590 | | |
585 | 591 | | |
586 | 592 | | |
587 | | - | |
| 593 | + | |
588 | 594 | | |
589 | 595 | | |
590 | 596 | | |
| |||
0 commit comments