Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Over-usage of stack frame in recursive calls #818

Open
kaigai opened this issue Jul 28, 2024 · 2 comments
Open

Over-usage of stack frame in recursive calls #818

kaigai opened this issue Jul 28, 2024 · 2 comments

Comments

@kaigai
Copy link
Contributor

kaigai commented Jul 28, 2024

#812の問題を調査中、再帰呼出しのやりすぎでstack frameの使い果たしが発生。

再帰呼出しの場合にスタック使用量をチェックする仕組みが必要。
LIKE句でも同様。

CUDA Exception: Warp Out-of-range Address
The exception was triggered at PC 0x7f62137d8190 (xpu_postgis.cu:73)
[Current focus set to CUDA kernel 0, grid 1207, block (21,0,0), thread (1,0,0), device 0, sm 42, warp 0, lane 1]
#0  0x00007f62137d8200 in _INTERNAL_61659473_14_xpu_postgis_cu_f2ffba3a::setup_geometry_rawsize ()
    at /home/kaigai/pg-strom/src/xpu_postgis.cu:75
75              switch (geom->type)
(cuda-gdb) bt
#0  0x00007f62137d8200 in _INTERNAL_61659473_14_xpu_postgis_cu_f2ffba3a::setup_geometry_rawsize ()
    at /home/kaigai/pg-strom/src/xpu_postgis.cu:75
#1  0x00007f6213b162e0 in _INTERNAL_61659473_14_xpu_postgis_cu_f2ffba3a::__geom_relate_seg_polygon ()
    at /home/kaigai/pg-strom/src/xpu_postgis.cu:165 in _ZN45_INTERNAL_61659473_14_xpu_postgis_cu_f2ffba3a21geometry_load_subitemEP14xpu_geometry_tPKS0_PKciP12kern_context inlined from xpu_postgis.cu:4937
#2  0x00007f6213b18530 in _INTERNAL_61659473_14_xpu_postgis_cu_f2ffba3a::__geom_relate_seg_polygon ()
    at /home/kaigai/pg-strom/src/xpu_postgis.cu:5249
#3  0x00007f6213b18530 in _INTERNAL_61659473_14_xpu_postgis_cu_f2ffba3a::__geom_relate_seg_polygon ()
    at /home/kaigai/pg-strom/src/xpu_postgis.cu:5249
#4  0x00007f6213b18530 in _INTERNAL_61659473_14_xpu_postgis_cu_f2ffba3a::__geom_relate_seg_polygon ()
    at /home/kaigai/pg-strom/src/xpu_postgis.cu:5249
#5  0x00007f6213cf4dc0 in pgfn_st_crosses ()
    at /home/kaigai/pg-strom/src/xpu_postgis.cu:5249 in _ZN45_INTERNAL_61659473_14_xpu_postgis_cu_f2ffba3a25__geom_relate_seg_polygonEP12kern_contextRK7POINT2DbS4_bPK14xpu_geometry_tib inlined from xpu_postgis.cu:5249
#6  0x00007f6213b73c00 in _INTERNAL_ffb4507b_13_xpu_common_cu___kcxt::pgfn_JoinQuals ()
    at /home/kaigai/pg-strom/src/xpu_common.cu:1184
#7  0x00007f6213bb99a0 in ExecGiSTIndexPostQuals () at /home/kaigai/pg-strom/src/xpu_common.cu:1939
#8  0x00007f6213b940a0 in kern_gpujoin_main<<<(108,1,1),(512,1,1)>>> ()
    at /home/kaigai/pg-strom/src/cuda_gpujoin.cu:473 in _ZN46_INTERNAL_20381b8c_15_cuda_gpujoin_cu_5fc7014219execGpuJoinGiSTJoinEP12kern_contextP17kern_warp_contextP14kern_multirelsiPcS6_PK15kern_expressionS6_RmRb inlined from cuda_gpujoin.cu:915
@kaigai
Copy link
Contributor Author

kaigai commented Jul 28, 2024

https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#stack-manipulation-instructions

stacksave 命令で現在のスタックポインタを取得する事ができる。
初期値 0x0100 0000から段々と減っていく感じだが、GPU間での差異は?

@kaigai
Copy link
Contributor Author

kaigai commented Jul 31, 2024

fd4c07d7c36dc190d9ab99b3d56d5d3b2bcd9405 でCUDA Stack Frameの利用チェックを導入。しかし、PostGISのロジックの中にエラーとbool値判定で区別していない部分が少なからず残っているので、必ずしも fallback に落ちてくれるわけではない。

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

No branches or pull requests

1 participant