Skip to content

Commit 027f565

Browse files
authored
[lang] Pass DebugInfo to frontend expressions (#8308)
Issue: # ### Brief Summary <!-- copilot:summary --> ### <samp>🤖 Generated by Copilot at 7e32e22</samp> This pull request adds a `dbg_info` argument to various functions and constructors related to expressions, statements, and texture operations in the Taichi frontend and IR. This argument is used to pass and store source code information for debugging purposes, which enables better error reporting and debugging experience for Taichi users and developers. ### Walkthrough <!-- copilot:walkthrough --> ### <samp>🤖 Generated by Copilot at 7e32e22</samp> * Add `dbg_info` parameters to various expression and statement constructors and function calls, which are used to store and pass the source code location and other debugging information for error reporting and debugging purposes. ([link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-c6d83b9e6291bedbadc82d8027e027fe6cdc4785a413467b722b4f55e6e59386L25-R27),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-c6d83b9e6291bedbadc82d8027e027fe6cdc4785a413467b722b4f55e6e59386L36-R39),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-c6d83b9e6291bedbadc82d8027e027fe6cdc4785a413467b722b4f55e6e59386L54-R58),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-c6d83b9e6291bedbadc82d8027e027fe6cdc4785a413467b722b4f55e6e59386L65-R72),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-c6d83b9e6291bedbadc82d8027e027fe6cdc4785a413467b722b4f55e6e59386L77-R84),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-2e623ee0b0eec1b200fead36c0627a3c54738f6d83d79757398dc67decc01da8L54-R55),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-3e22417ffade4af0564893b98dc5101d714b8ba6fd4423ab5bc5129e360fee8fL1436-R1441),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-99744c5ae5f6a754d6f68408fdc64fb0d6097216518a7f3d1ef43ffe12599577L132-R136),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-99744c5ae5f6a754d6f68408fdc64fb0d6097216518a7f3d1ef43ffe12599577L242-R243),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-575efc738df7b1202370c2531ec82232dc7f287b2bec4999af03ef40da4f5deeL135-R136),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-575efc738df7b1202370c2531ec82232dc7f287b2bec4999af03ef40da4f5deeL141-R144),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a157043b38542c8145447ff342fda65fe4d54fb777fe514daa70007e83e20dc1R257),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a157043b38542c8145447ff342fda65fe4d54fb777fe514daa70007e83e20dc1L263-R264),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a157043b38542c8145447ff342fda65fe4d54fb777fe514daa70007e83e20dc1L269-R270),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a157043b38542c8145447ff342fda65fe4d54fb777fe514daa70007e83e20dc1L276-R277),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a157043b38542c8145447ff342fda65fe4d54fb777fe514daa70007e83e20dc1L285-R292),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-5913c0a6b6a5e279414150955f30b96ea6b9676a1f5b1931ca4bcb39f19c81e9L153-R158),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-5913c0a6b6a5e279414150955f30b96ea6b9676a1f5b1931ca4bcb39f19c81e9L175-R185),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-5913c0a6b6a5e279414150955f30b96ea6b9676a1f5b1931ca4bcb39f19c81e9L1446-R1462),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-c48bb572255ef55d0c9fd89c9febab88b9668e10dfcfc1fac88feb1be7bd94caL360-R374),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-c48bb572255ef55d0c9fd89c9febab88b9668e10dfcfc1fac88feb1be7bd94caR600),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-c48bb572255ef55d0c9fd89c9febab88b9668e10dfcfc1fac88feb1be7bd94caL640-R658),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a028ff808aee30ba7b2c634414a762b6178d6608ae50cf636a2cab5b2af0da62L566-R568),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a028ff808aee30ba7b2c634414a762b6178d6608ae50cf636a2cab5b2af0da62L575-R579),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a028ff808aee30ba7b2c634414a762b6178d6608ae50cf636a2cab5b2af0da62L703-R711),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-059028cb0798284bed05638becbc32d256736846de19746e196fe5f5ee7fd061L23-R27),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-62fecfc4627bafe9c85cf060fe4d4531c429a383a263df2efa6cbb28c812efd2L400-R401),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-62fecfc4627bafe9c85cf060fe4d4531c429a383a263df2efa6cbb28c812efd2L444-R446),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-62fecfc4627bafe9c85cf060fe4d4531c429a383a263df2efa6cbb28c812efd2L463-R466),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-3154e0533b9fd63e663c16c2e87c65068c3b002a65cf80529b6577d173bdb5feL688-R694),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-624846f1ff7dabb76aa363a9a4b946ad67e2083a2a2521d10f2fc47232dff137L116-R127),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-5a1643cd518f6b50f7019462e057d759dd0c85b13c4e2dacde79ee3a5e2db2ecL141-R149),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L186-R189),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L296-R298),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L331-R333),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L450-R460),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L478-R481),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L488-R504),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L511-R514),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L620-R623),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L987-R991),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1006-R1009),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1078-R1085),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1148-R1159),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1174-R1183),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1273-R1281),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1287-R1295),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1305-R1314),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1319-R1328),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1338-R1347),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1344-R1353),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1362-R1374),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1373-R1389),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1383-R1399),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1393-R1409),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1481-R1497),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1494-R1510),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1562-R1579),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1569-R1592),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1581-R1600),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1589-R1609),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1655-R1681),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1670-R1691),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1676-R1697),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1686-R1715),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1843-R1867),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1865-R1889),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1877-R1902),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1905-R1946),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L1925-R1954),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35R1962),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL391-R394),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL404-R409),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL441-R459),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL642-R656),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL704-R719),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL720-R737),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL802-R819),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL836-R857),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL852-R875),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL872-R897),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL892-R919),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL905-R932),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL926-R955),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL933-R964),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL957-R988),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL969-R1002),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL1030-R1066),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL1062-R1104),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL1076-R1124),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL1097-R1139),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-05e2a2d0a9c9879a4fb5fde9baf5a43738c7601fc53e234a40ab9bc27d1512a5L162-R164),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-05e2a2d0a9c9879a4fb5fde9baf5a43738c7601fc53e234a40ab9bc27d1512a5L169-R179),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-05e2a2d0a9c9879a4fb5fde9baf5a43738c7601fc53e234a40ab9bc27d1512a5L190-R195),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L267-R268),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L600-R602),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L615-R619),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L723-R732),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L753-R763),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L771-R782),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L862-R874),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L902-R914),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L978-R992),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L1149-R1164),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L1173-R1191),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L1694-R1714),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L1703-R1728),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L1720-R1746),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L1970-R1998),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L1981-R2011),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L2028-R2063),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L2047-R2082),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-af631a0c71978fe591e17005f01f7c06bc30ae36c65df306bbb3b08ade770167L907-R908),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-af631a0c71978fe591e17005f01f7c06bc30ae36c65df306bbb3b08ade770167L1023-R1025),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-af631a0c71978fe591e17005f01f7c06bc30ae36c65df306bbb3b08ade770167L1045-R1051),[link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-af631a0c71978fe591e17005f01f7c06bc30ae36c65df306bbb3b08ade770167L1130-R1174)) * Use the `operand_stmt->dbg_info` instead of the `dbg_info` field of the `UnaryOpExpression` class, which is more consistent with the source code information of the operand expression. ([link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35L296-R298)) * Reorder the parameters of the `BinaryOpStmt` constructor, by moving the `dbg_info` parameter to the end of the parameter list, to make it consistent with other statement constructors. ([link](https://github.com/taichi-dev/taichi/pull/8308/files?diff=unified&w=0#diff-917d9436dcaafa0f1e41ae9bad90273a303f036f00da94e417788a7fa1dc5260L267-R268))
1 parent 2b8a97a commit 027f565

19 files changed

+415
-210
lines changed

python/taichi/lang/_texture.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ def __init__(self, ptr_expr, num_dims) -> None:
2222
@taichi_scope
2323
def sample_lod(self, uv, lod):
2424
ast_builder = impl.get_runtime().compiling_callable.ast_builder()
25+
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
2526
args_group = make_expr_group(*_get_entries(uv), lod)
26-
v = ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kSampleLod, self.ptr_expr, args_group)
27+
v = ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kSampleLod, self.ptr_expr, args_group, dbg_info)
2728
r = impl.call_internal("composite_extract_0", v, with_runtime_context=False)
2829
g = impl.call_internal("composite_extract_1", v, with_runtime_context=False)
2930
b = impl.call_internal("composite_extract_2", v, with_runtime_context=False)
@@ -33,8 +34,9 @@ def sample_lod(self, uv, lod):
3334
@taichi_scope
3435
def fetch(self, index, lod):
3536
ast_builder = impl.get_runtime().compiling_callable.ast_builder()
37+
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
3638
args_group = make_expr_group(*_get_entries(index), lod)
37-
v = ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kFetchTexel, self.ptr_expr, args_group)
39+
v = ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kFetchTexel, self.ptr_expr, args_group, dbg_info)
3840
r = impl.call_internal("composite_extract_0", v, with_runtime_context=False)
3941
g = impl.call_internal("composite_extract_1", v, with_runtime_context=False)
4042
b = impl.call_internal("composite_extract_2", v, with_runtime_context=False)
@@ -51,8 +53,9 @@ def __init__(self, ptr_expr, num_dims) -> None:
5153
@taichi_scope
5254
def load(self, index):
5355
ast_builder = impl.get_runtime().compiling_callable.ast_builder()
56+
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
5457
args_group = make_expr_group(*_get_entries(index))
55-
v = ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kLoad, self.ptr_expr, args_group)
58+
v = ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kLoad, self.ptr_expr, args_group, dbg_info)
5659
r = impl.call_internal("composite_extract_0", v, with_runtime_context=False)
5760
g = impl.call_internal("composite_extract_1", v, with_runtime_context=False)
5861
b = impl.call_internal("composite_extract_2", v, with_runtime_context=False)
@@ -62,8 +65,11 @@ def load(self, index):
6265
@taichi_scope
6366
def store(self, index, value):
6467
ast_builder = impl.get_runtime().compiling_callable.ast_builder()
68+
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
6569
args_group = make_expr_group(*_get_entries(index), *_get_entries(value))
66-
impl.expr_init(ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kStore, self.ptr_expr, args_group))
70+
impl.expr_init(
71+
ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kStore, self.ptr_expr, args_group, dbg_info)
72+
)
6773

6874
@property
6975
@taichi_scope
@@ -74,7 +80,8 @@ def shape(self):
7480
List[Int]: The result list.
7581
"""
7682
dim = _ti_core.get_external_tensor_dim(self.ptr_expr)
77-
ret = [Expr(_ti_core.get_external_tensor_shape_along_axis(self.ptr_expr, i)) for i in range(dim)]
83+
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
84+
ret = [Expr(_ti_core.get_external_tensor_shape_along_axis(self.ptr_expr, i, dbg_info)) for i in range(dim)]
7885
return ret
7986

8087
@taichi_scope

python/taichi/lang/any_array.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def shape(self):
5151
List[Int]: The result list.
5252
"""
5353
dim = _ti_core.get_external_tensor_dim(self.ptr)
54-
return [Expr(_ti_core.get_external_tensor_shape_along_axis(self.ptr, i)) for i in range(dim)]
54+
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
55+
return [Expr(_ti_core.get_external_tensor_shape_along_axis(self.ptr, i, dbg_info)) for i in range(dim)]
5556

5657
@taichi_scope
5758
def _loop_range(self):

python/taichi/lang/ast/ast_transformer.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,12 @@ def build_mesh_for(ctx, node):
14331433
assert isinstance(ctx.mesh, impl.MeshInstance)
14341434
mesh_idx = mesh.MeshElementFieldProxy(ctx.mesh, node.iter.ptr._type, var.ptr)
14351435
ctx.create_variable(target, mesh_idx)
1436-
ctx.ast_builder.begin_frontend_mesh_for(mesh_idx.ptr, ctx.mesh.mesh_ptr, node.iter.ptr._type)
1436+
ctx.ast_builder.begin_frontend_mesh_for(
1437+
mesh_idx.ptr,
1438+
ctx.mesh.mesh_ptr,
1439+
node.iter.ptr._type,
1440+
_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
1441+
)
14371442
build_stmts(ctx, node.body)
14381443
ctx.mesh = None
14391444
ctx.ast_builder.end_frontend_mesh_for()

python/taichi/lang/impl.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,11 @@ def begin_frontend_struct_for(ast_builder, group, loop_range):
129129
f"({group.size()} != {len(loop_range.shape)}). Maybe you wanted to "
130130
'use "for I in ti.grouped(x)" to group all indices into a single vector I?'
131131
)
132+
dbg_info = _ti_core.DebugInfo(get_runtime().get_current_src_info())
132133
if isinstance(loop_range, (AnyArray, RWTextureAccessor)):
133-
ast_builder.begin_frontend_struct_for_on_external_tensor(group, loop_range._loop_range())
134+
ast_builder.begin_frontend_struct_for_on_external_tensor(group, loop_range._loop_range(), dbg_info)
134135
else:
135-
ast_builder.begin_frontend_struct_for_on_snode(group, loop_range._loop_range())
136+
ast_builder.begin_frontend_struct_for_on_snode(group, loop_range._loop_range(), dbg_info)
136137

137138

138139
def begin_frontend_if(ast_builder, cond, stmt_dbg_info):
@@ -239,10 +240,7 @@ def subscript(ast_builder, value, *_indices, skip_reordered=False):
239240
[
240241
Expr(
241242
ast_builder.mesh_index_conversion(
242-
value.mesh_ptr,
243-
value.element_type,
244-
Expr(indices[0]).ptr,
245-
ConvType.g2r,
243+
value.mesh_ptr, value.element_type, Expr(indices[0]).ptr, ConvType.g2r, dbg_info
246244
)
247245
)
248246
]

python/taichi/lang/kernel_arguments.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,16 @@ def decl_ndarray_arg(element_type, ndim, name, needs_grad, boundary):
132132
def decl_texture_arg(num_dimensions, name):
133133
# FIXME: texture_arg doesn't have element_shape so better separate them
134134
arg_id = impl.get_runtime().compiling_callable.insert_texture_param(num_dimensions, name)
135-
return TextureSampler(_ti_core.make_texture_ptr_expr(arg_id, num_dimensions, 0), num_dimensions)
135+
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
136+
return TextureSampler(_ti_core.make_texture_ptr_expr(arg_id, num_dimensions, 0, dbg_info), num_dimensions)
136137

137138

138139
def decl_rw_texture_arg(num_dimensions, buffer_format, lod, name):
139140
# FIXME: texture_arg doesn't have element_shape so better separate them
140141
arg_id = impl.get_runtime().compiling_callable.insert_rw_texture_param(num_dimensions, buffer_format, name)
142+
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
141143
return RWTextureAccessor(
142-
_ti_core.make_rw_texture_ptr_expr(arg_id, num_dimensions, 0, buffer_format, lod),
143-
num_dimensions,
144+
_ti_core.make_rw_texture_ptr_expr(arg_id, num_dimensions, 0, buffer_format, lod, dbg_info), num_dimensions
144145
)
145146

146147

python/taichi/lang/kernel_impl.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,26 +254,27 @@ def func_call_rvalue(self, key, args):
254254
# Skip the template args, e.g., |self|
255255
assert self.is_real_function
256256
non_template_args = []
257+
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
257258
for i, kernel_arg in enumerate(self.arguments):
258259
anno = kernel_arg.annotation
259260
if not isinstance(anno, template):
260261
if id(anno) in primitive_types.type_ids:
261262
non_template_args.append(ops.cast(args[i], anno))
262263
elif isinstance(anno, primitive_types.RefType):
263-
non_template_args.append(_ti_core.make_reference(args[i].ptr))
264+
non_template_args.append(_ti_core.make_reference(args[i].ptr, dbg_info))
264265
elif isinstance(anno, ndarray_type.NdarrayType):
265266
if not isinstance(args[i], AnyArray):
266267
raise TaichiTypeError(
267268
f"Expected ndarray in the kernel argument for argument {kernel_arg.name}, got {args[i]}"
268269
)
269-
non_template_args += _ti_core.get_external_tensor_real_func_args(args[i].ptr)
270+
non_template_args += _ti_core.get_external_tensor_real_func_args(args[i].ptr, dbg_info)
270271
else:
271272
non_template_args.append(args[i])
272273
non_template_args = impl.make_expr_group(non_template_args)
273274
func_call = (
274275
impl.get_runtime()
275276
.compiling_callable.ast_builder()
276-
.insert_func_call(self.taichi_functions[key.instance_id], non_template_args)
277+
.insert_func_call(self.taichi_functions[key.instance_id], non_template_args, dbg_info)
277278
)
278279
if self.return_type is None:
279280
return None
@@ -282,7 +283,13 @@ def func_call_rvalue(self, key, args):
282283

283284
for i, return_type in enumerate(self.return_type):
284285
if id(return_type) in primitive_types.type_ids:
285-
ret.append(Expr(_ti_core.make_get_element_expr(func_call.ptr, (i,))))
286+
ret.append(
287+
Expr(
288+
_ti_core.make_get_element_expr(
289+
func_call.ptr, (i,), _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
290+
)
291+
)
292+
)
286293
elif isinstance(return_type, (StructType, MatrixType)):
287294
ret.append(return_type.from_taichi_object(func_call, (i,)))
288295
else:

python/taichi/lang/matrix.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,12 @@ def make_matrix_with_shape(arr, shape, dt):
150150
return expr.Expr(
151151
impl.get_runtime()
152152
.compiling_callable.ast_builder()
153-
.make_matrix_expr(shape, dt, [expr.Expr(elt).ptr for elt in arr])
153+
.make_matrix_expr(
154+
shape,
155+
dt,
156+
[expr.Expr(elt).ptr for elt in arr],
157+
ti_python_core.DebugInfo(impl.get_runtime().get_current_src_info()),
158+
)
154159
)
155160

156161

@@ -172,7 +177,12 @@ def make_matrix(arr, dt=None):
172177
return expr.Expr(
173178
impl.get_runtime()
174179
.compiling_callable.ast_builder()
175-
.make_matrix_expr(shape, dt, [expr.Expr(elt).ptr for elt in arr])
180+
.make_matrix_expr(
181+
shape,
182+
dt,
183+
[expr.Expr(elt).ptr for elt in arr],
184+
ti_python_core.DebugInfo(impl.get_runtime().get_current_src_info()),
185+
)
176186
)
177187

178188

@@ -1443,7 +1453,13 @@ def __call__(self, *args):
14431453
def from_taichi_object(self, func_ret, ret_index=()):
14441454
return self(
14451455
[
1446-
expr.Expr(ti_python_core.make_get_element_expr(func_ret.ptr, ret_index + (i,)))
1456+
expr.Expr(
1457+
ti_python_core.make_get_element_expr(
1458+
func_ret.ptr,
1459+
ret_index + (i,),
1460+
_ti_python_core.DebugInfo(impl.get_runtime().get_current_src_info()),
1461+
)
1462+
)
14471463
for i in range(self.m * self.n)
14481464
]
14491465
)

python/taichi/lang/mesh.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,21 @@ def add_mesh_attribute(self, element_type, snode, reorder_type):
357357
_ti_core.add_mesh_attribute(self.mesh_ptr, element_type, snode, reorder_type)
358358

359359
def get_relation_size(self, from_index, to_element_type):
360-
return _ti_core.get_relation_size(self.mesh_ptr, from_index.ptr, to_element_type)
360+
return _ti_core.get_relation_size(
361+
self.mesh_ptr,
362+
from_index.ptr,
363+
to_element_type,
364+
_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
365+
)
361366

362367
def get_relation_access(self, from_index, to_element_type, neighbor_idx_ptr):
363-
return _ti_core.get_relation_access(self.mesh_ptr, from_index.ptr, to_element_type, neighbor_idx_ptr)
368+
return _ti_core.get_relation_access(
369+
self.mesh_ptr,
370+
from_index.ptr,
371+
to_element_type,
372+
neighbor_idx_ptr,
373+
_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
374+
)
364375

365376

366377
class MeshMetadata:
@@ -586,6 +597,7 @@ def __init__(self, mesh: MeshInstance, element_type: MeshElementType, entry_expr
586597
element_type,
587598
entry_expr,
588599
ConvType.l2r if element_field.attr_dict[key].reorder else ConvType.l2g,
600+
_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
589601
)
590602
) # transform index space
591603
global_entry_expr_group = impl.make_expr_group(*tuple([global_entry_expr]))
@@ -637,7 +649,13 @@ def ptr(self):
637649
def id(self): # return the global non-reordered index
638650
ast_builder = impl.get_runtime().compiling_callable.ast_builder()
639651
l2g_expr = impl.Expr(
640-
ast_builder.mesh_index_conversion(self.mesh.mesh_ptr, self.element_type, self.entry_expr, ConvType.l2g)
652+
ast_builder.mesh_index_conversion(
653+
self.mesh.mesh_ptr,
654+
self.element_type,
655+
self.entry_expr,
656+
ConvType.l2g,
657+
_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
658+
)
641659
)
642660
return l2g_expr
643661

python/taichi/lang/misc.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,9 @@ def assume_in_range(val, base, low, high):
563563
>>> x
564564
10
565565
"""
566-
return _ti_core.expr_assume_in_range(Expr(val).ptr, Expr(base).ptr, low, high)
566+
return _ti_core.expr_assume_in_range(
567+
Expr(val).ptr, Expr(base).ptr, low, high, _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
568+
)
567569

568570

569571
def loop_unique(val, covers=None):
@@ -572,7 +574,9 @@ def loop_unique(val, covers=None):
572574
if not isinstance(covers, (list, tuple)):
573575
covers = [covers]
574576
covers = [x.snode.ptr if isinstance(x, Expr) else x.ptr for x in covers]
575-
return _ti_core.expr_loop_unique(Expr(val).ptr, covers)
577+
return _ti_core.expr_loop_unique(
578+
Expr(val).ptr, covers, _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
579+
)
576580

577581

578582
def _parallelize(v):
@@ -700,7 +704,11 @@ def mesh_patch_idx():
700704
701705
Related to https://github.com/taichi-dev/taichi/issues/3608
702706
"""
703-
return impl.get_runtime().compiling_callable.ast_builder().insert_patch_idx_expr()
707+
return (
708+
impl.get_runtime()
709+
.compiling_callable.ast_builder()
710+
.insert_patch_idx_expr(_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()))
711+
)
704712

705713

706714
def is_arch_supported(arch):

python/taichi/lang/ops.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ def is_taichi_expr(a):
2020

2121

2222
def wrap_if_not_expr(a):
23-
return expr.Expr(a) if not is_taichi_expr(a) else a
23+
return (
24+
expr.Expr(a, dbg_info=_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()))
25+
if not is_taichi_expr(a)
26+
else a
27+
)
2428

2529

2630
def _read_matrix_or_scalar(x):

0 commit comments

Comments
 (0)