Skip to content

Commit

Permalink
[lang] Pass DebugInfo to frontend expressions (#8308)
Browse files Browse the repository at this point in the history
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))
  • Loading branch information
dream189free authored Aug 1, 2023
1 parent 2b8a97a commit 027f565
Show file tree
Hide file tree
Showing 19 changed files with 415 additions and 210 deletions.
17 changes: 12 additions & 5 deletions python/taichi/lang/_texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ def __init__(self, ptr_expr, num_dims) -> None:
@taichi_scope
def sample_lod(self, uv, lod):
ast_builder = impl.get_runtime().compiling_callable.ast_builder()
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
args_group = make_expr_group(*_get_entries(uv), lod)
v = ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kSampleLod, self.ptr_expr, args_group)
v = ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kSampleLod, self.ptr_expr, args_group, dbg_info)
r = impl.call_internal("composite_extract_0", v, with_runtime_context=False)
g = impl.call_internal("composite_extract_1", v, with_runtime_context=False)
b = impl.call_internal("composite_extract_2", v, with_runtime_context=False)
Expand All @@ -33,8 +34,9 @@ def sample_lod(self, uv, lod):
@taichi_scope
def fetch(self, index, lod):
ast_builder = impl.get_runtime().compiling_callable.ast_builder()
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
args_group = make_expr_group(*_get_entries(index), lod)
v = ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kFetchTexel, self.ptr_expr, args_group)
v = ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kFetchTexel, self.ptr_expr, args_group, dbg_info)
r = impl.call_internal("composite_extract_0", v, with_runtime_context=False)
g = impl.call_internal("composite_extract_1", v, with_runtime_context=False)
b = impl.call_internal("composite_extract_2", v, with_runtime_context=False)
Expand All @@ -51,8 +53,9 @@ def __init__(self, ptr_expr, num_dims) -> None:
@taichi_scope
def load(self, index):
ast_builder = impl.get_runtime().compiling_callable.ast_builder()
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
args_group = make_expr_group(*_get_entries(index))
v = ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kLoad, self.ptr_expr, args_group)
v = ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kLoad, self.ptr_expr, args_group, dbg_info)
r = impl.call_internal("composite_extract_0", v, with_runtime_context=False)
g = impl.call_internal("composite_extract_1", v, with_runtime_context=False)
b = impl.call_internal("composite_extract_2", v, with_runtime_context=False)
Expand All @@ -62,8 +65,11 @@ def load(self, index):
@taichi_scope
def store(self, index, value):
ast_builder = impl.get_runtime().compiling_callable.ast_builder()
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
args_group = make_expr_group(*_get_entries(index), *_get_entries(value))
impl.expr_init(ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kStore, self.ptr_expr, args_group))
impl.expr_init(
ast_builder.make_texture_op_expr(_ti_core.TextureOpType.kStore, self.ptr_expr, args_group, dbg_info)
)

@property
@taichi_scope
Expand All @@ -74,7 +80,8 @@ def shape(self):
List[Int]: The result list.
"""
dim = _ti_core.get_external_tensor_dim(self.ptr_expr)
ret = [Expr(_ti_core.get_external_tensor_shape_along_axis(self.ptr_expr, i)) for i in range(dim)]
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
ret = [Expr(_ti_core.get_external_tensor_shape_along_axis(self.ptr_expr, i, dbg_info)) for i in range(dim)]
return ret

@taichi_scope
Expand Down
3 changes: 2 additions & 1 deletion python/taichi/lang/any_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def shape(self):
List[Int]: The result list.
"""
dim = _ti_core.get_external_tensor_dim(self.ptr)
return [Expr(_ti_core.get_external_tensor_shape_along_axis(self.ptr, i)) for i in range(dim)]
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
return [Expr(_ti_core.get_external_tensor_shape_along_axis(self.ptr, i, dbg_info)) for i in range(dim)]

@taichi_scope
def _loop_range(self):
Expand Down
7 changes: 6 additions & 1 deletion python/taichi/lang/ast/ast_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,12 @@ def build_mesh_for(ctx, node):
assert isinstance(ctx.mesh, impl.MeshInstance)
mesh_idx = mesh.MeshElementFieldProxy(ctx.mesh, node.iter.ptr._type, var.ptr)
ctx.create_variable(target, mesh_idx)
ctx.ast_builder.begin_frontend_mesh_for(mesh_idx.ptr, ctx.mesh.mesh_ptr, node.iter.ptr._type)
ctx.ast_builder.begin_frontend_mesh_for(
mesh_idx.ptr,
ctx.mesh.mesh_ptr,
node.iter.ptr._type,
_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
)
build_stmts(ctx, node.body)
ctx.mesh = None
ctx.ast_builder.end_frontend_mesh_for()
Expand Down
10 changes: 4 additions & 6 deletions python/taichi/lang/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ def begin_frontend_struct_for(ast_builder, group, loop_range):
f"({group.size()} != {len(loop_range.shape)}). Maybe you wanted to "
'use "for I in ti.grouped(x)" to group all indices into a single vector I?'
)
dbg_info = _ti_core.DebugInfo(get_runtime().get_current_src_info())
if isinstance(loop_range, (AnyArray, RWTextureAccessor)):
ast_builder.begin_frontend_struct_for_on_external_tensor(group, loop_range._loop_range())
ast_builder.begin_frontend_struct_for_on_external_tensor(group, loop_range._loop_range(), dbg_info)
else:
ast_builder.begin_frontend_struct_for_on_snode(group, loop_range._loop_range())
ast_builder.begin_frontend_struct_for_on_snode(group, loop_range._loop_range(), dbg_info)


def begin_frontend_if(ast_builder, cond, stmt_dbg_info):
Expand Down Expand Up @@ -239,10 +240,7 @@ def subscript(ast_builder, value, *_indices, skip_reordered=False):
[
Expr(
ast_builder.mesh_index_conversion(
value.mesh_ptr,
value.element_type,
Expr(indices[0]).ptr,
ConvType.g2r,
value.mesh_ptr, value.element_type, Expr(indices[0]).ptr, ConvType.g2r, dbg_info
)
)
]
Expand Down
7 changes: 4 additions & 3 deletions python/taichi/lang/kernel_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,16 @@ def decl_ndarray_arg(element_type, ndim, name, needs_grad, boundary):
def decl_texture_arg(num_dimensions, name):
# FIXME: texture_arg doesn't have element_shape so better separate them
arg_id = impl.get_runtime().compiling_callable.insert_texture_param(num_dimensions, name)
return TextureSampler(_ti_core.make_texture_ptr_expr(arg_id, num_dimensions, 0), num_dimensions)
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
return TextureSampler(_ti_core.make_texture_ptr_expr(arg_id, num_dimensions, 0, dbg_info), num_dimensions)


def decl_rw_texture_arg(num_dimensions, buffer_format, lod, name):
# FIXME: texture_arg doesn't have element_shape so better separate them
arg_id = impl.get_runtime().compiling_callable.insert_rw_texture_param(num_dimensions, buffer_format, name)
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
return RWTextureAccessor(
_ti_core.make_rw_texture_ptr_expr(arg_id, num_dimensions, 0, buffer_format, lod),
num_dimensions,
_ti_core.make_rw_texture_ptr_expr(arg_id, num_dimensions, 0, buffer_format, lod, dbg_info), num_dimensions
)


Expand Down
15 changes: 11 additions & 4 deletions python/taichi/lang/kernel_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,26 +254,27 @@ def func_call_rvalue(self, key, args):
# Skip the template args, e.g., |self|
assert self.is_real_function
non_template_args = []
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
for i, kernel_arg in enumerate(self.arguments):
anno = kernel_arg.annotation
if not isinstance(anno, template):
if id(anno) in primitive_types.type_ids:
non_template_args.append(ops.cast(args[i], anno))
elif isinstance(anno, primitive_types.RefType):
non_template_args.append(_ti_core.make_reference(args[i].ptr))
non_template_args.append(_ti_core.make_reference(args[i].ptr, dbg_info))
elif isinstance(anno, ndarray_type.NdarrayType):
if not isinstance(args[i], AnyArray):
raise TaichiTypeError(
f"Expected ndarray in the kernel argument for argument {kernel_arg.name}, got {args[i]}"
)
non_template_args += _ti_core.get_external_tensor_real_func_args(args[i].ptr)
non_template_args += _ti_core.get_external_tensor_real_func_args(args[i].ptr, dbg_info)
else:
non_template_args.append(args[i])
non_template_args = impl.make_expr_group(non_template_args)
func_call = (
impl.get_runtime()
.compiling_callable.ast_builder()
.insert_func_call(self.taichi_functions[key.instance_id], non_template_args)
.insert_func_call(self.taichi_functions[key.instance_id], non_template_args, dbg_info)
)
if self.return_type is None:
return None
Expand All @@ -282,7 +283,13 @@ def func_call_rvalue(self, key, args):

for i, return_type in enumerate(self.return_type):
if id(return_type) in primitive_types.type_ids:
ret.append(Expr(_ti_core.make_get_element_expr(func_call.ptr, (i,))))
ret.append(
Expr(
_ti_core.make_get_element_expr(
func_call.ptr, (i,), _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
)
)
)
elif isinstance(return_type, (StructType, MatrixType)):
ret.append(return_type.from_taichi_object(func_call, (i,)))
else:
Expand Down
22 changes: 19 additions & 3 deletions python/taichi/lang/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ def make_matrix_with_shape(arr, shape, dt):
return expr.Expr(
impl.get_runtime()
.compiling_callable.ast_builder()
.make_matrix_expr(shape, dt, [expr.Expr(elt).ptr for elt in arr])
.make_matrix_expr(
shape,
dt,
[expr.Expr(elt).ptr for elt in arr],
ti_python_core.DebugInfo(impl.get_runtime().get_current_src_info()),
)
)


Expand All @@ -172,7 +177,12 @@ def make_matrix(arr, dt=None):
return expr.Expr(
impl.get_runtime()
.compiling_callable.ast_builder()
.make_matrix_expr(shape, dt, [expr.Expr(elt).ptr for elt in arr])
.make_matrix_expr(
shape,
dt,
[expr.Expr(elt).ptr for elt in arr],
ti_python_core.DebugInfo(impl.get_runtime().get_current_src_info()),
)
)


Expand Down Expand Up @@ -1443,7 +1453,13 @@ def __call__(self, *args):
def from_taichi_object(self, func_ret, ret_index=()):
return self(
[
expr.Expr(ti_python_core.make_get_element_expr(func_ret.ptr, ret_index + (i,)))
expr.Expr(
ti_python_core.make_get_element_expr(
func_ret.ptr,
ret_index + (i,),
_ti_python_core.DebugInfo(impl.get_runtime().get_current_src_info()),
)
)
for i in range(self.m * self.n)
]
)
Expand Down
24 changes: 21 additions & 3 deletions python/taichi/lang/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,21 @@ def add_mesh_attribute(self, element_type, snode, reorder_type):
_ti_core.add_mesh_attribute(self.mesh_ptr, element_type, snode, reorder_type)

def get_relation_size(self, from_index, to_element_type):
return _ti_core.get_relation_size(self.mesh_ptr, from_index.ptr, to_element_type)
return _ti_core.get_relation_size(
self.mesh_ptr,
from_index.ptr,
to_element_type,
_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
)

def get_relation_access(self, from_index, to_element_type, neighbor_idx_ptr):
return _ti_core.get_relation_access(self.mesh_ptr, from_index.ptr, to_element_type, neighbor_idx_ptr)
return _ti_core.get_relation_access(
self.mesh_ptr,
from_index.ptr,
to_element_type,
neighbor_idx_ptr,
_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
)


class MeshMetadata:
Expand Down Expand Up @@ -586,6 +597,7 @@ def __init__(self, mesh: MeshInstance, element_type: MeshElementType, entry_expr
element_type,
entry_expr,
ConvType.l2r if element_field.attr_dict[key].reorder else ConvType.l2g,
_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
)
) # transform index space
global_entry_expr_group = impl.make_expr_group(*tuple([global_entry_expr]))
Expand Down Expand Up @@ -637,7 +649,13 @@ def ptr(self):
def id(self): # return the global non-reordered index
ast_builder = impl.get_runtime().compiling_callable.ast_builder()
l2g_expr = impl.Expr(
ast_builder.mesh_index_conversion(self.mesh.mesh_ptr, self.element_type, self.entry_expr, ConvType.l2g)
ast_builder.mesh_index_conversion(
self.mesh.mesh_ptr,
self.element_type,
self.entry_expr,
ConvType.l2g,
_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
)
)
return l2g_expr

Expand Down
14 changes: 11 additions & 3 deletions python/taichi/lang/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,9 @@ def assume_in_range(val, base, low, high):
>>> x
10
"""
return _ti_core.expr_assume_in_range(Expr(val).ptr, Expr(base).ptr, low, high)
return _ti_core.expr_assume_in_range(
Expr(val).ptr, Expr(base).ptr, low, high, _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
)


def loop_unique(val, covers=None):
Expand All @@ -572,7 +574,9 @@ def loop_unique(val, covers=None):
if not isinstance(covers, (list, tuple)):
covers = [covers]
covers = [x.snode.ptr if isinstance(x, Expr) else x.ptr for x in covers]
return _ti_core.expr_loop_unique(Expr(val).ptr, covers)
return _ti_core.expr_loop_unique(
Expr(val).ptr, covers, _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
)


def _parallelize(v):
Expand Down Expand Up @@ -700,7 +704,11 @@ def mesh_patch_idx():
Related to https://github.com/taichi-dev/taichi/issues/3608
"""
return impl.get_runtime().compiling_callable.ast_builder().insert_patch_idx_expr()
return (
impl.get_runtime()
.compiling_callable.ast_builder()
.insert_patch_idx_expr(_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()))
)


def is_arch_supported(arch):
Expand Down
6 changes: 5 additions & 1 deletion python/taichi/lang/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ def is_taichi_expr(a):


def wrap_if_not_expr(a):
return expr.Expr(a) if not is_taichi_expr(a) else a
return (
expr.Expr(a, dbg_info=_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()))
if not is_taichi_expr(a)
else a
)


def _read_matrix_or_scalar(x):
Expand Down
9 changes: 6 additions & 3 deletions python/taichi/lang/snode.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ def is_active(node, indices):
return expr.Expr(
impl.get_runtime()
.compiling_callable.ast_builder()
.expr_snode_is_active(node._snode.ptr, expr.make_expr_group(indices))
.expr_snode_is_active(node._snode.ptr, expr.make_expr_group(indices)),
dbg_info=_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
)


Expand Down Expand Up @@ -441,7 +442,8 @@ def length(node, indices):
return expr.Expr(
impl.get_runtime()
.compiling_callable.ast_builder()
.expr_snode_length(node._snode.ptr, expr.make_expr_group(indices))
.expr_snode_length(node._snode.ptr, expr.make_expr_group(indices)),
dbg_info=_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
)


Expand All @@ -460,7 +462,8 @@ def get_addr(f, indices):
return expr.Expr(
impl.get_runtime()
.compiling_callable.ast_builder()
.expr_snode_get_addr(f._snode.ptr, expr.make_expr_group(indices))
.expr_snode_get_addr(f._snode.ptr, expr.make_expr_group(indices)),
dbg_info=_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
)


Expand Down
8 changes: 7 additions & 1 deletion python/taichi/lang/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,13 @@ def from_taichi_object(self, func_ret, ret_index=()):
if isinstance(dtype, CompoundType):
d[name] = dtype.from_taichi_object(func_ret, ret_index + (index,))
else:
d[name] = expr.Expr(_ti_core.make_get_element_expr(func_ret.ptr, ret_index + (index,)))
d[name] = expr.Expr(
_ti_core.make_get_element_expr(
func_ret.ptr,
ret_index + (index,),
_ti_core.DebugInfo(impl.get_runtime().get_current_src_info()),
)
)
d["__struct_methods"] = self.methods

struct = Struct(d)
Expand Down
18 changes: 12 additions & 6 deletions taichi/ir/expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,18 @@ Expr expr_rand(DataType dt) {
return Expr::make<RandExpression>(dt);
}

Expr assume_range(const Expr &expr, const Expr &base, int low, int high) {
return Expr::make<RangeAssumptionExpression>(expr, base, low, high);
}

Expr loop_unique(const Expr &input, const std::vector<SNode *> &covers) {
return Expr::make<LoopUniqueExpression>(input, covers);
Expr assume_range(const Expr &expr,
const Expr &base,
int low,
int high,
const DebugInfo &dbg_info) {
return Expr::make<RangeAssumptionExpression>(expr, base, low, high, dbg_info);
}

Expr loop_unique(const Expr &input,
const std::vector<SNode *> &covers,
const DebugInfo &dbg_info) {
return Expr::make<LoopUniqueExpression>(input, covers, dbg_info);
}

Expr expr_field(Expr id_expr, DataType dt) {
Expand Down
12 changes: 9 additions & 3 deletions taichi/ir/expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,15 @@ Expr expr_rand() {
return taichi::lang::expr_rand(get_data_type<T>());
}

Expr assume_range(const Expr &expr, const Expr &base, int low, int high);

Expr loop_unique(const Expr &input, const std::vector<SNode *> &covers);
Expr assume_range(const Expr &expr,
const Expr &base,
int low,
int high,
const DebugInfo &dbg_info = DebugInfo());

Expr loop_unique(const Expr &input,
const std::vector<SNode *> &covers,
const DebugInfo &dbg_info = DebugInfo());

Expr expr_field(Expr id_expr, DataType dt);

Expand Down
Loading

0 comments on commit 027f565

Please sign in to comment.