slyubomirsky opened a new pull request, #14148:
URL: https://github.com/apache/tvm/pull/14148

   [Rendered 
view.](https://github.com/slyubomirsky/tvm/blob/relax-spec-draft/relax_spec.md)
   
   (Transferred from https://github.com/tlc-pack/relax/pull/273, see the old PR 
for older discussions and comments.)
   
   This document is a draft language specification for Relax. The purpose of 
the language specification is to serve as a technical reference describing the 
language's behavior in sufficient detail as to clarify the intended behavior of 
the compiler, hence it is by design a very detailed document rather than an 
accessible tutorial for the language. Its focus is the "what" and "how" of 
Relax, but not always the "why," though we can add more sections giving design 
reasons if that is desired.
   
   Note that «double caret marks» (guillemets) are used to denote parts of the 
specification discussing functionality that the present prototype doesn't yet 
support. This notation is somewhat cumbersome, but I wasn't sure how else to 
proceed because Github Markdown does not support changing the text color (which 
was how my initial document indicated these areas). The caret marks may look 
strange in the text, but they have the benefit of being easy to find by text 
search.
   
   Out of scope, for now, in this document is the subject of parsing: We should 
eventually document how we intend to parse Python into Relax, but the parser 
itself is being greatly reworked. We can revisit the issue of documenting its 
behavior once that work has been completed. Additionally, this specification is 
intended (for now) to focus on the user-visible behavior of Relax rather than 
specifying lower-level interfaces or the precise mechanisms of Relax's 
implementation.
   
   # Aspects Requiring Review or Still to be Determined
   
   Since this document is a draft, any part of it is up for review and open to 
revision, but certain parts of the document have proven particularly 
challenging to describe and could benefit the most from community discussions.
   
   1. The `StructInfo` system has been a great challenge to specify and there 
are many questions as to how it should work. One question is whether "strong 
shaping" might lead to too many error messages for something that could be 
checked dynamically. Additionally, many potential shape mismatches could be 
eliminated using constant propagation or other transformations: If we check 
shapes without applying transformations, we would force users to add lots of 
redundant shape checks. On the other hand, if we require these transformations 
first, that might make the code harder for users to reason about.
   2. The run-time representations of values in the language will be important 
for determining how `PackedFunc`s can interact with Relax values. However, 
embedded targets do not support the TVM object system, so describing values in 
terms of the TVM object system directly may not work for all settings. 
Additionally, it should be determined how much detail about the representations 
should be included in the specification.
   3. Operators used for core language functions (like `call_tir`) should be 
described in the specification. I am not certain the descriptions presently in 
the last section are entirely correct, so more review of them should be 
appreciated. Additionally, are there operators that should be there but are 
presently missing?
   4. Finally, there is the question of _process_: How will we permit the 
specification to be revised? Does any change require a fresh RFC? Is there a 
threshold for changes that can be done as a direct PR? I have not considered 
this question directly, but the language specification is an important document 
for the community and changes to the language specification should not be taken 
lightly.
   
   There are also some more minor TODOs throughout the document.
   
   # The Future of This Document
   
   Eventually, we will want this document to be part of the Relax 
documentation, in which case it will be placed into a different location in the 
repo and probably be formatted as an `rst` file. Before that, we will 
officially RFC the spec into TVM to allow for maximum public discussion as to 
the design decisions underlying the specification. Hence, I am going to leave 
this document as a "WIP PR" until it is officially RFC'd.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to