[webkit-changes] [WebKit/WebKit] a65584: [WGSL] Add support for f16

Tadeu Zagallo noreply at github.com
Mon Nov 20 03:23:18 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a6558404e75ec86ed1931fb2144eb4080e47133a
      https://github.com/WebKit/WebKit/commit/a6558404e75ec86ed1931fb2144eb4080e47133a
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-11-20 (Mon, 20 Nov 2023)

  Changed paths:
    M Source/WTF/wtf/PlatformHave.h
    M Source/WebGPU/WGSL/AST/AST.h
    M Source/WebGPU/WGSL/AST/ASTExpression.h
    A Source/WebGPU/WGSL/AST/ASTFloat16Literal.h
    M Source/WebGPU/WGSL/AST/ASTForward.h
    M Source/WebGPU/WGSL/AST/ASTNode.h
    M Source/WebGPU/WGSL/AST/ASTStringDumper.cpp
    M Source/WebGPU/WGSL/AST/ASTStringDumper.h
    M Source/WebGPU/WGSL/AST/ASTVisitor.cpp
    M Source/WebGPU/WGSL/AST/ASTVisitor.h
    M Source/WebGPU/WGSL/ConstantFunctions.h
    M Source/WebGPU/WGSL/ConstantValue.cpp
    M Source/WebGPU/WGSL/ConstantValue.h
    M Source/WebGPU/WGSL/Constraints.cpp
    M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
    M Source/WebGPU/WGSL/Lexer.cpp
    M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
    M Source/WebGPU/WGSL/Parser.cpp
    M Source/WebGPU/WGSL/Token.cpp
    M Source/WebGPU/WGSL/Token.h
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Source/WebGPU/WGSL/TypeDeclarations.rb
    M Source/WebGPU/WGSL/TypeStore.cpp
    M Source/WebGPU/WGSL/TypeStore.h
    M Source/WebGPU/WGSL/Types.cpp
    M Source/WebGPU/WGSL/Types.h
    M Source/WebGPU/WGSL/generator/main.rb
    M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj

  Log Message:
  -----------
  [WGSL] Add support for f16
https://bugs.webkit.org/show_bug.cgi?id=265024
rdar://118561000

Reviewed by Mike Wyrzykowski.

Add support for f16 values and operations. Tests will be included in a follow-up
patch, as I ended up rewriting a lot of the tests, but this was also tested against
the CTS and passes all of the f16 binary expression tests.

* Source/WebGPU/WGSL/AST/AST.h:
* Source/WebGPU/WGSL/AST/ASTExpression.h:
(isType):
* Source/WebGPU/WGSL/AST/ASTFloat16Literal.h: Added.
* Source/WebGPU/WGSL/AST/ASTForward.h:
* Source/WebGPU/WGSL/AST/ASTNode.h:
* Source/WebGPU/WGSL/AST/ASTStringDumper.cpp:
(WGSL::AST::StringDumper::visit):
* Source/WebGPU/WGSL/AST/ASTStringDumper.h:
* Source/WebGPU/WGSL/AST/ASTVisitor.cpp:
(WGSL::AST::Visitor::visit):
* Source/WebGPU/WGSL/AST/ASTVisitor.h:
* Source/WebGPU/WGSL/ConstantFunctions.h:
(WGSL::zeroValue):
(WGSL::constantUnaryOperation):
(WGSL::constantBinaryOperation):
(WGSL::constantTernaryOperation):
(WGSL::constantConstructor):
(WGSL::CONSTANT_FUNCTION):
(WGSL::BINARY_OPERATION):
* Source/WebGPU/WGSL/ConstantValue.cpp:
(WGSL::ConstantValue::dump const):
* Source/WebGPU/WGSL/ConstantValue.h:
(WGSL::ConstantValue::isBool const):
(WGSL::ConstantValue::toBool const):
(WGSL::convertFloat):
(WGSL::ConstantValue::isI32 const): Deleted.
(WGSL::ConstantValue::isU32 const): Deleted.
(WGSL::ConstantValue::isAbstractInt const): Deleted.
(WGSL::ConstantValue::isF32 const): Deleted.
(WGSL::ConstantValue::isAbstractFloat const): Deleted.
(WGSL::ConstantValue::toF32 const): Deleted.
* Source/WebGPU/WGSL/Constraints.cpp:
(WGSL::satisfies):
(WGSL::satisfyOrPromote):
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::pack):
(WGSL::bindingMemberForGlobal):
(WGSL::RewriteGlobalVariables::usesOverride):
* Source/WebGPU/WGSL/Lexer.cpp:
(WGSL::Lexer<T>::lexNumber):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::emitPackedVector):
(WGSL::Metal::FunctionDefinitionWriter::visit):
(WGSL::Metal::FunctionDefinitionWriter::serializeConstant):
* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser<Lexer>::parsePrimaryExpression):
* Source/WebGPU/WGSL/Token.cpp:
(WGSL::toString):
* Source/WebGPU/WGSL/Token.h:
(WGSL::Token::Token):
(WGSL::Token::operator=):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::TypeChecker):
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::convertValue):
* Source/WebGPU/WGSL/TypeDeclarations.rb:
* Source/WebGPU/WGSL/TypeStore.cpp:
(WGSL::TypeStore::TypeStore):
* Source/WebGPU/WGSL/TypeStore.h:
(WGSL::TypeStore::f16Type const):
* Source/WebGPU/WGSL/Types.cpp:
(WGSL::conversionRank):
(WGSL::Type::size const):
(WGSL::Type::alignment const):
* Source/WebGPU/WGSL/Types.h:
* Source/WebGPU/WGSL/generator/main.rb:
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:
* Source/WTF/wtf/PlatformHave.h:

Canonical link: https://commits.webkit.org/270970@main




More information about the webkit-changes mailing list