You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a file that I'm editing as with jinja-cpp formatter.
I import a macro from another file with:
{%- from 'macros.jinja' import declare_smem_arrays with context %}
The macro in its entirety is:
{#
First input argument consists of a dictionary with keys _common_ and _per_warp_.
Keys map to lists of tuples with (name, dtype, num_elements) of each subarray.
#}
{%- macro declare_smem_arrays(arrays, warp_loc_var, config) %}
{%- set warps_per_block = divide(config.num_threads, config.warp_size) %}
extern __shared__ char s[];
{%- set ns = {"offset": 0, "total_warp_bytes": 0} %}
{%- for name, dtype, num_elements in arrays["common"] %}
{{dtype}}* {{name}} = ({{dtype}}*) (s + {{ ns["offset"] }});
{% do ns.update({"offset": ns["offset"] + num_elements * sizeof(dtype)}) %}
{% if ns["offset"] > config.smem %}
{{ raise("Error, required shared memory exceeds allocation maximum!") }}
{% endif %}
{%- endfor %}
{%- for name, dtype, num_elements in arrays["per_warp"] %}
{% do ns.update({"total_warp_bytes": ns["total_warp_bytes"] + num_elements * sizeof(dtype)}) %}
{%- endfor %}
{%- if ns["offset"] + ns["total_warp_bytes"] * warps_per_block > config.smem %}
{{ raise("Error, required shared memory exceeds allocation maximum!") }}
{%- endif %}
char* per_warp_smem = s + {{ns["offset"]}} + {{ns["total_warp_bytes"]}} * {{ warp_loc_var }};
{%- do ns.update({"offset": 0}) %}
{%- for name, dtype, num_elements in arrays["per_warp"] %}
{{dtype}}* {{name}} = ({{dtype}}*) (per_warp_smem + {{ ns["offset"] }});
{% do ns.update({"offset": ns["offset"] + num_elements * sizeof(dtype)}) %}
{%- endfor %}
{%- endmacro %}
When I use the macro, later in the file, something goes wrong and it views the rest of the file as a comment or invalid.
This is not actually a performance issue, the template and macro works perfectly. It's just the visiualization / highlighting that is broken.
Please let me know if there's something I should be doing differently with whitespace or something to solve this.
I tried putting it all on one line and it still would not parse, so I don't think it's related to the line breaks.
If there are any logs or anything I can include to help, let me know, thank you!
The text was updated successfully, but these errors were encountered:
I've got a file that I'm editing as with
jinja-cpp
formatter.I import a macro from another file with:
The macro in its entirety is:
When I use the macro, later in the file, something goes wrong and it views the rest of the file as a comment or invalid.
This is not actually a performance issue, the template and macro works perfectly. It's just the visiualization / highlighting that is broken.
I've included the text that causes the error.
Please let me know if there's something I should be doing differently with whitespace or something to solve this.
I tried putting it all on one line and it still would not parse, so I don't think it's related to the line breaks.
If there are any logs or anything I can include to help, let me know, thank you!
The text was updated successfully, but these errors were encountered: