[PATCH] D97857: [Matrix] Add support for matrix-by-scalar division.

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 10 13:31:26 PST 2021


rjmccall added inline comments.


================
Comment at: clang/docs/MatrixTypes.rst:127
+is only supported for expression ``M1 / S1``, where ``M1`` is of matrix type
+and ``S1`` is of a real type.
 
----------------
You don't need to be so formal in this paragraph, because you're about to get into a more formal treatment.  I'd just say something like:

> Given two matrixes, the ``+`` and ``-`` operators perform element-wise addition and subtraction, while the ``*`` operator performs matrix multiplication.  ``+``, ``-``, ``*``, and ``/`` can also be used with a matrix and a scalar value, applying the operation to each element of the matrix.
>
> Earlier versions of this extension did not support division by a scalar.  You can test for the availability of this feature with ``__has_extension(matrix_types_scalar_division)``.


================
Comment at: clang/docs/MatrixTypes.rst:131
 at least one of ``M1`` or ``M2`` is of matrix type and, for `*`, the other is of
 a real type:
 
----------------
You need to rework this paragraph, something like:

> For the expression ``M1 BIN_OP M2`` where
> - ``BIN_OP`` is one of ``+`` or ``-``, one of ``M1`` and ``M2`` is of matrix type, and the other is of matrix type or real type; or
> - ``BIN_OP`` is ``*``, one of ``M1`` and ``M2`` is of matrix type, and the other is of a real type; or
> - ``BIN_OP`` is ``/``, ``M1`` is of matrix type, and ``M2`` is of a real type:


================
Comment at: clang/include/clang/Basic/LangOptions.def:399
+LANGOPT(MatrixTypesScalarDiv, 1, 1, "Enable or disable scalar division support "
+                                    "for matrix types")
 
----------------
Why is this a language option?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97857/new/

https://reviews.llvm.org/D97857



More information about the llvm-commits mailing list