GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — API Proposal: Ceil, Floor for Vector<T> · Issue #20509 · dotnet/runtime

API Proposal: Ceil, Floor for Vector<T> #20509

New issue
Copy link
New issue
Copy link
Closed
#31993
Closed
API Proposal: Ceil, Floor for Vector<T>#20509
#31993
Copy link
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Numericshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Future

Description

@mjmckp
mjmckp
opened on Mar 7, 2017
Issue body actions

This is a proposal of the ideas discussed in issue #20147.

There are a few SIMD operations on System.Numerics.Vector<T> missing that are required to implement vectorized versions of log, exp, sin, and cos.

There is a C implementation of these methods using AVX intrinsics here, which I have translated into a C# implemention using Vector<T> here. In the implementation, I have added fake versions of the missing intrinsics.

@mellinoe suggested creating two separate issues for the missing methods (the other issue is dotnet/corefx#16835), so the purpose of this issue is to propose the addition of the following methods:

[Updated proposal with comments below]

namespace System.Numerics
{
    public static class Vector
    {
        public static Vector<float> Floor(Vector<float> value);
        public static Vector<double> Floor(Vector<double> value);
        public static Vector<float> Ceiling(Vector<float> value);
        public static Vector<double> Ceiling(Vector<double> value);
    }
}

which map directly to the following AVX intrinsics:

_mm256_floor_ps
_mm256_floor_pd
_mm256_ceil_ps
_mm256_ceil_pd

respectively.

Reacted by Haytham ElFadeel, itsamelambda and Joannes Vermorel

Activity

  1. mjmckp
    changed the title [-]API Proposal: Ceil, Floor, and Add for Vector<T>[/-] [+]API Proposal: Ceil, Floor for Vector<T>[/+] on Mar 7, 2017
  2. mellinoe commented on Mar 8, 2017

    @mellinoe
    mellinoe
    on Mar 8, 2017
    Contributor
    More actions

    These seem really straightforward to me, and are a common operation in many algorithms. Any concerns about the feasibility in the JIT, or in other non-AVX architectures? @sivarv

  3. sivarv commented on Mar 8, 2017

    @sivarv
    sivarv
    on Mar 8, 2017
    Contributor
    More actions

    CC @russellhadley

    As per Intel manual, these C++ intrinsics are wrappers over roundps/roundpd instructions with rounding mode specified using an immediate byte. roundps/pd is supported on SSE4_1 and above. Given RyuJIT also supports SSE3_4 mode, which is more common than SSE2 alone, we should consider implementing these intrinsics.

  4. mellinoe commented on Mar 8, 2017

    @mellinoe
    mellinoe
    on Mar 8, 2017
    Contributor
    More actions

    This one seems so straightforward that I'm just going to mark it as api-ready-for-review.

    Reacted by mjmckp, Jack Mott and itsamelambda
  5. terrajobst commented on Mar 14, 2017

    @terrajobst
    terrajobst
    on Mar 14, 2017
    Contributor
    More actions

    Looks good, but we'd suggest changing x to value and Ceil to Ceiling, to be consistent with Math:

    namespace System.Numerics
    {
        public static class Vector
        {
            public static Vector<float> Floor(Vector<float> value);
            public static Vector<double> Floor(Vector<double> value);
            public static Vector<float> Ceiling(Vector<float> value);
            public static Vector<double> Ceiling(Vector<double> value);
        }
    }
    Reacted by Jack Mott and itsamelambda
  6. Gnbrkm41 commented on Oct 14, 2019

    @Gnbrkm41
    Gnbrkm41
    on Oct 14, 2019
    Contributor
    More actions

    I would like to take a look at this.

  7. tannergooding
    assigned
    Gnbrkm41
    on Oct 14, 2019
  8. tannergooding commented on Oct 14, 2019

    @tannergooding
    tannergooding
    on Oct 14, 2019
    Member
    More actions

    I talked with @Gnbrkm41 about this briefly in the C# Discord and what would be the process for getting this done 😄

    Reacted by Ganbarukamo41
  9. danmoseley commented on Jan 29, 2020

    @danmoseley
    danmoseley
    on Jan 29, 2020
    Contributor
    More actions

    @Gnbrkm41 how is it going on this one?

  10. Gnbrkm41 commented on Jan 30, 2020

    @Gnbrkm41
    Gnbrkm41
    on Jan 30, 2020
    Contributor
    More actions

    Been wondering if the intrinsics part could be implemented in C# (#956) since there's a few conversion methods introduced to convert between Vector and HWIntrinsics vector types not so long ago, then apparently I've forgotten about it 😅 Thanks for the ping. I can give it a try still but feel free to unassign if this is a problem.

  11. msftgits
    transferred this issue fromdotnet/corefxon Jan 31, 2020
  12. msftgits
    added this to the Future milestone on Jan 31, 2020
  13. Gnbrkm41 commented on Feb 2, 2020

    @Gnbrkm41
    Gnbrkm41
    on Feb 2, 2020
    Contributor
    More actions

    Should this throw for any non-floating point types, like int/short/etc? it really doesn't make to ceil/floor those data types because they are integral types.

  14. maryamariyan
    added
    untriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
    on Feb 23, 2020
  15. tannergooding
    removed
    untriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
    on Mar 2, 2020
  16. tannergooding commented on Mar 2, 2020

    @tannergooding
    tannergooding
    on Mar 2, 2020
    Member
    More actions

    Should this throw for any non-floating point types, like int/short/etc? it really doesn't make to ceil/floor those data types because they are integral types.

    @Gnbrkm41, The proposed and approved API surface is only for float/double, so we shouldn't need to consider the integral types.

  17. tannergooding
    closed this as completedin #31993on Mar 16, 2020
  18. tannergooding commented on Mar 16, 2020

    @tannergooding
    tannergooding
    on Mar 16, 2020
    Member
    More actions

    Resolved in #31993

  19. tannergooding
    unassigned
    Gnbrkm41
    on Mar 16, 2020
  20. ghost locked as resolved and limited conversation to collaborators on Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Numericshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors

    Type

    No type

    Projects

    No projects

      Milestone

      • FutureNo due date

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.