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

[Lang] Support formatted printing in str.format() and f-strings #7686

Merged
merged 7 commits into from
Mar 31, 2023

Conversation

dream189free
Copy link
Contributor

Issue: #5949

Brief Summary

This PR enables formatted printing in Taichi scope using str.format() and f-strings.

@netlify
Copy link

netlify bot commented Mar 29, 2023

Deploy Preview for docsite-preview canceled.

Name Link
🔨 Latest commit 561f50d
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/6426489dc8d61d0008e82d16

@dream189free dream189free marked this pull request as ready for review March 29, 2023 14:10
Copy link
Contributor

@jim19930609 jim19930609 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic-wise it looks good to me!

However, I was thinking merge_printf_specifier should aim at returning a backend-agnostic result of formatted string (only does the "merge" operation), and the adaptions for specific backends (vulkan, cuda, etc) can be done inside each codegen_cuda.cpp, codegen_spirv.cpp of visit(PrintStmt *stmt). What do you think?

Copy link
Contributor

@jim19930609 jim19930609 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

@dream189free dream189free merged commit 56991ac into taichi-dev:master Mar 31, 2023
quadpixels pushed a commit to quadpixels/taichi that referenced this pull request May 13, 2023
…hi-dev#7686)

Issue: taichi-dev#5949

### Brief Summary
This PR enables formatted printing in Taichi scope using `str.format()`
and f-strings.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

2 participants