Displaying 20 results from an estimated 10000 matches similar to: "should we have IR intrinsics for integer min/max?"
2016 Nov 08
2
should we have IR intrinsics for integer min/max?
Thanks, Hal and Matt for the feedback. As usual, my instincts about
canonicalization were probably wrong. :)
I thought that @max1 vs. @max3 would be viewed as an unknowable trade-off
between reducing the dependency chain and the pseudo-canonical min/max
form, so we'd add intrinsics, and defer that decision to the backend.
I'll wait to see if there are any other arguments presented.
2009 Dec 28
2
Modified R Code
Dear R helpers,
I have following input files. (Actually they are more than 10 rates but here i am considering only 2 rates to write my problem)
rate1.csv
min1 max1 min2 max2 min3 max3
1.05 1.30 1.30 1.65 1.65 1.99
rate2.csv
min1 max1 min2 max2 min3
2017 May 16
2
[RFC] Canonicalization of unsigned subtraction with saturation
On 5/16/2017 6:30 AM, Sanjay Patel wrote:
> Thanks for posting this question, Julia.
>
> I had a similar question about a signed min/max variant here:
> http://lists.llvm.org/pipermail/llvm-dev/2016-November/106868.html
>
> The 2nd version in each case contains a canonical max/min
> representation in IR, and this could enable more IR analysis.
> A secondary advantage is
2017 Jul 01
8
[IR canonicalization] 6 ways to choose {-1,0,1}
I'm looking at the output of memcmp() expansion (D34904), and I noticed
that there are many ways to produce the common positive/zero/negative
comparison result in IR.
For the following 6 functionally equivalent C source functions, we produce
6 different versions of IR which leads to 6 different asm outputs for x86.
Which of these should we choose as canonical IR form?
1. Two selects
int
2008 Apr 15
1
disturbing seed dependence in optim L-BFGS-B method
The the use of optim with the L-BFGS-B method for the following simple
function gives erroneous results. Any help appreciated!
Best,
Bob Reilly
# Code:
V=function(p){
p1=p[1];p2=p[2]
y=p1*p2-.4*(p1+p2)
return(-y)}
p=c(.2,.2) # p=c(.8,.8)
max=optim(p,V,method = "L-BFGS-B",lower=c(0,0),upper=c(1,1))
max1=optim(max$par,V,method = "L-BFGS-B",lower=c(0,0),upper=c(1,1))
2017 Jan 23
1
[PATCH] virtio_net: fix PAGE_SIZE > 64k
I don't have any guests with PAGE_SIZE > 64k but the
code seems to be clearly broken in that case
as PAGE_SIZE / MERGEABLE_BUFFER_ALIGN will need
more than 8 bit and so the code in mergeable_ctx_to_buf_address
does not give us the actual true size.
Cc: John Fastabend <john.fastabend at gmail.com>
Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
---
Lightly tested on x86
2017 Jan 23
1
[PATCH] virtio_net: fix PAGE_SIZE > 64k
I don't have any guests with PAGE_SIZE > 64k but the
code seems to be clearly broken in that case
as PAGE_SIZE / MERGEABLE_BUFFER_ALIGN will need
more than 8 bit and so the code in mergeable_ctx_to_buf_address
does not give us the actual true size.
Cc: John Fastabend <john.fastabend at gmail.com>
Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
---
Lightly tested on x86
2009 Jun 04
3
Fast way of finding top-n values of a long vector
If x is a (long) vector and n << length(x), what is a fast way of
finding the top-n values of x?
Some suggestions (calculating the ratio of the two top values):
library("rbenchmark")
set.seed(1); x <- runif(1e6, max=1e7); x[1] <- NA;
benchmark(
replications=20,
columns=c("test","elapsed"),
order="elapsed"
, sort = {a<-sort(x,
2017 May 16
2
[RFC] Canonicalization of unsigned subtraction with saturation
Hi,
This message is a result of a discussion of backend optimization for sub(max) pattern(https://reviews.llvm.org/D25987), which can be either converted to unsigned min-max or unsigned saturation instruction(if the target supports it).
Currently these versions of the code produce different IR(and we need to manage both types in backend):
(1.16)
void foo(unsigned short *p, unsigned short max,
2016 Mar 10
2
[CodeGen] PeepholeOptimizer: optimizing condition dependent instrunctions
Hi Quentin,
Yes, the code allows to process connected instructions. Although it should be taken into account that the instruction next to the current processed instruction must never be erased because this invalidates iterator.
I've been fixing a bug in AArch64InstrInfo::optimizeCompareInstr: instructions are converted into S form but it's not checked that they produce the same flags as
2015 Feb 05
3
[LLVMdev] Proposal for Poison Semantics
On Wed, Feb 4, 2015 at 11:24 AM, John Regehr <regehr at cs.utah.edu> wrote:
> I am actively working towards removing poison altogether. I think a more
>> accurate model of LLVM's wrapping
>> flags is not poison but instead something akin to the fast-math flags on
>> floating point instructions.
>>
>
> Looking forward to seeing it. One of my students has
2012 Jan 27
3
Subsetting for the ten highest values by group in a dataframe
Hello,
I am looking for a way to subset a data frame by choosing the top ten
maximum values from that dataframe. As well this occurs within some
factor levels.
## I've used plyr here but I'm not married to this approach
require(plyr)
## I've created a data.frame with two groups and then a id variable (y)
df <- data.frame(x=rnorm(400, mean=20), y=1:400,
2013 Jan 18
0
[LLVMdev] simple optimization question
Hi Bjorn,
> currently the following two lines of code with integer variables get compiled completely differently:
>
> if (d0<tmp) d0=tmp;
there must be something else going on because this
void bar(int);
void foo(int d0, int tmp) {
if (d0 < tmp) d0=tmp;
bar(d0);
}
when compiled like this
clang -S -O4 -o - sel.c
gives this
define void @foo(i32 %d0, i32 %tmp) nounwind
2016 Mar 09
2
[CodeGen] PeepholeOptimizer: optimizing condition dependent instrunctions
Hi,
I find it's quite strange how condition dependent instructions are processed in PeepholeOptimizer::runOnMachineFunction:
01577 if ((isUncoalescableCopy(*MI) &&
01578 optimizeUncoalescableCopy(MI, LocalMIs)) ||
01579 (MI->isCompare() && optimizeCmpInstr(MI, &MBB)) ||
01580 (MI->isSelect() && optimizeSelect(MI,
2015 Jan 28
15
[LLVMdev] RFC: Proposal for Poison Semantics
Hello,
What follows is my attempt to describe how poison works. Let me know what
you think.
--
David
# LLVM Poison Semantics
Poison is an LLVM concept which exists solely to enable further
optimization of LLVM IR. The exact behavior of poison has been, to say the
least, confusing for users, researchers and engineers working with LLVM.
This document hopes to clear up some of the confusion
2014 Sep 19
2
[LLVMdev] poison and select
Today I ran into another aspect of the poison problem...
Basically, SimplifyCFG wants to take
expr1 && expr2
and flatten it into
x = expr1
y = expr2
x&y
This isn't safe when expr2 might execute UB. The consequence is that no
LLVM shift instruction is safe to speculatively execute, nor is any
nsw/nuw/exact variant, unless the operands can be proven to be in
2012 Mar 08
2
[LLVMdev] -indvars issues?
Hi,
Is the -indvars pass functional? I've done some small test to check it, but this fails to canonicalize:
> int *x;
> int *y;
> int i;
> ...
> for (i = 1; i < 100; i+=2) {
> x[i] = y[i] + 3;
> }
The IR produced after -indvars:
> br label %for.cond
>
> for.cond: ; preds = %for.inc, %entry
> %indvars.iv =
2009 Apr 28
3
truehist and density plots
Hi,
I wanted to plot the histogram of a vector and then, plot the density function of subsets of the vector on the histogram. So I use truehist in MASS package and lines(density) as follows:
length(b) = 1000
truehist(b)
lines(density(b[1:100]))
however the density plot of the first 100 points exceeds the max of y axis (see attached). how is it possible to make a graphics so that the density plot
2016 May 19
4
GEP index canonicalization
Hi,
InstCombine canonicalizes index operands (unless they are into struct
types) to pointer size. The comment says: "If we are using a wider
index than needed for this platform, shrink it to what we need. If
narrower, sign-extend it to what we need. This explicit cast can make
subsequent optimizations more obvious.".
For our architecture, the canonicalization is a bit
2013 Jan 18
2
[LLVMdev] simple optimization question
Hi,
currently the following two lines of code with integer variables get compiled completely differently:
if (d0<tmp) d0=tmp;
d0 = d0<tmp? tmp : do;
The first is compiled into two separate basic blocks, which my backend then optimizes into a conditional move with if-conversion (after instruction selection so not much optimization possible anymore). The second line is compiled into