# Expand Span for imported module

**URL:** <https://discuss.tvm.apache.org/t/expand-span-for-imported-module/8435>\
**Category:** RFC\
**Created:** [November 11, 2020, 7:36am UTC](https://discuss.tvm.apache.org/t/expand-span-for-imported-module/8435 "2020-11-11T07:36:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lixiaoquan](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/lixiaoquan/32/245_2.png) [@lixiaoquan](https://discuss.tvm.apache.org/u/lixiaoquan)\
**Post date:** [November 11, 2020, 7:36am UTC](https://discuss.tvm.apache.org/t/expand-span-for-imported-module/8435/1 "2020-11-11T07:36:03Z")

</div>

In this PR [https://github.com/apache/incubator-tvm/pull/6885](https://github.com/apache/incubator-tvm/pull/6885), node name is stored in Span.SourceName.

Since Span.SourceName is supposed to represent name of source file, I’d suggest to add another field `hint` to Span to represent node or layer name which is common in models.

And when model is imported, its name isn’t kept by frontend, so Span.SourceName will be left empty in that case. `line`, `colume`, `end_line` and `end_colume` aren’t needed too for imported model.

@joshua19881228 @jroesch @tqchen @FrozenGene Please share your thought

---

<div class="post-metadata">

**Author:** ![FrozenGene](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/frozengene/32/1114_2.png) [@FrozenGene](https://discuss.tvm.apache.org/u/FrozenGene)\
**Post date:** [November 11, 2020, 9:08am UTC](https://discuss.tvm.apache.org/t/expand-span-for-imported-module/8435/2 "2020-11-11T09:08:42Z")

</div>

I would like to add one `flags` attribute to make us have more extension for the future. Like we could have `Span: (sourcename: ..., line:... column:... flags: SPFlagSourceNameImportedFromModel, ...)` Then we could query the flags attribute to handle the specific condition.

---

<div class="post-metadata">

**Author:** ![tkonolige](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/tkonolige/32/1972_2.png) [@tkonolige](https://discuss.tvm.apache.org/u/tkonolige)\
**Post date:** [November 11, 2020, 5:55pm UTC](https://discuss.tvm.apache.org/t/expand-span-for-imported-module/8435/3 "2020-11-11T17:55:56Z")

</div>

@jroesch and I were talking about this a little. We were thinking of subclassing Span. You’d have SourceSpan which comes from files and then ModelSpan (probably could use a better name) for handling layers/nodes in models. This gets around the issue of having meaningless line fields for spans from models.
