satacker

Untitled

Apr 3rd, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.75 KB | None | 0 0
  1. rtohid
  2. matrixb0tx
  3. any thoughts onthis
  4. from what I understand, you'll still need to provide the implementation for each instance of the opaque type anyway, so not a solution to the original problem, but more of a cleaner implementation approach
  5. matrixb0tx
  6. I would have to write custom binding for for every .hpp containing templates (all of them) and not templates can be . I am thinking a way to automate it this was the easiest way to do it by making is opaque . and cppyy . there so many differnt things you can do deciding which is right out is hard
  7. for clarity, maintainability, and keeping control, I don't think using cppyy is the way to go. I'd say starting with partial support for commonly used types would be the way to start. Once you've got driving examples rolling it would be easier to find a solution to extend the work
  8. hkaiser
  9. rtohid
  10. : he is not here today and logging is off
  11. satacker
  12. In reply to
  13. matrixb0tx
  14. rtohid
  15. for clarity, maintainability, and keeping control, I don't think using cppyy is the way to go. I'd say starting with partial support for commonly used types would be the way to start. Once you've got driving examples rolling it would be easier to find a solution to extend the work
  16. also cppyy does not support cpython 3+
  17. nooo, it does
  18. rtohid
  19. hkaiser
  20. rtohid
  21. : he is not here today and logging is off
  22. thanks! Meanwhile, can you share your insights on this? I'm generally interested to see if there's an elegant solution to bind template functions like this:
  23. https://github.com/pybind/pybind11/issues/199
  24.  
  25. Template functions · Issue #199 · pybind/pybind11 - GitHub
  26. Is it possible to define template functions like #include <pybind11/pybind11.h> #include <pybind11/numpy.h> namespace py = pybind11; template <typename T> T square(T x) { return x * x; } void pyexp...
  27. hkaiser
  28. rtohid
  29. : you can't really bind template functions for arbitrary types - temolate functions are not functions after all
  30. rtohid
  31. hkaiser
  32. rtohid
  33. : you can't really bind template functions for arbitrary types - temolate functions are not functions after all
  34. So I guess JIT compilation is the only solution after all-- I suggested this to
  35. matrixb0tx
  36. but wasn't sure
  37. satacker
  38. How will JIT be used to infer types?
  39. hkaiser
  40. if you want to bind a template function for arbitrary type - yes, that sounds right
  41. the question is do we need to bind them for arbitrary types to begin with?
  42. for instance for binding async - the function to be called will most likely be a pythong function, so async could simply pass through all arguments as PyObjects
  43. rtohid
  44. satacker
  45. How will JIT be used to infer types?
  46. We have used python AST to inspect code before:
  47. https://github.com/STEllAR-GROUP/phylanx/tree/master/python/phylanx
  48.  
  49. phylanx/python/phylanx at master · STEllAR-GROUP/phylanx - GitHub
  50. An Asynchronous Distributed C++ Array Processing Toolkit - phylanx/python/phylanx at master · STEllAR-GROUP/phylanx
  51. requiring type hints can make things even easier
  52. hkaiser
  53. yah, but that's not using JIT, at least not in the common way this term is used
  54. satacker
  55. In reply to
  56. satacker
  57. rtohid
  58. We have used python AST to inspect code before:
  59. https://github.com/STEllAR-GROUP/phylanx/tree/master/python/phylanx
  60. ohh, i just took JIT to be something much later in the pipeline, i.e. after knowing types
  61. rtohid
  62. hkaiser
  63. the question is do we need to bind them for arbitrary types to begin with?
  64. It was my understanding that most facilities are template functions but I guess it is the opposite and only a few are
  65. hkaiser
  66. yah, but that's not using JIT, at least not in the common way this term is used
  67. I just meant for type inference, not code generation
  68. hkaiser
  69. pybind allows to pass through variables back to python - that's what we most likely want to do
  70. rtohid
  71. In reply to
  72. rtohid
  73. satacker
  74. ohh, i just took JIT to be something much later in the pipeline, i.e. after knowing types
  75. you're right, types must be known
  76. satacker
  77. In reply to
  78. satacker
  79. rtohid
  80. We have used python AST to inspect code before:
  81. https://github.com/STEllAR-GROUP/phylanx/tree/master/python/phylanx
  82. Does it do something similar to https://benhoyt.com/writings/pyast64/
  83. i.e. visit each node type and if known types are found then do stuff
  84.  
  85. Compiling Python syntax to x86-64 assembly for fun and (zero) profit
  86. A toy (but working) compiler that turns Python syntax into x86-64 assembly using Python's built-in AST module.
  87. rtohid
  88. Yes. We just transpiled to our own IR (PhySL)
  89. satacker
  90. Nice!
  91. hkaiser
  92. ahh matrixb0tx, we were just talking about your project
  93. matrixb0tx
  94. I cant see chat logs the site is down for some rean
  95. reason*
  96. hkaiser
  97. rtohid
  98. : ^^
  99. matrixb0tx
  100. can anything thing done about the logs I wanted to see some suggestion for my project
  101. hkaiser
  102. matrixb0tx: logs are down today because of some maintenance going on
Advertisement
Add Comment
Please, Sign In to add comment