LLVM front end register class error OpenCL -- GPU target - opencl

I've recently been encountering this error when compiling OpenCL kernel files with my LLVM_IR pass:
aoc: ../../../TargetRegisterInfo.cpp:89: const llvm::TargetRegisterClass* llvm::TargetRegisterInfo::getMinimalPhysRegClass(unsigned int, llvm::EVT) const: Assertion `BestRC && "Couldn't find the register class"' failed.
I'm not sure what this means. What I've read from the documention doesn't make a lot of sense. Basically it means the backend doesn't know what type to place into the register?
Does anyone know what the error means?
It occurs in various kernels and doesn't seem to have a definitive pattern I can show as an example. I can post more details if needed, but really I'd just like to know what the error is telling me.
Thanks ahead of time for any help.
UPDATE:
It seems this command in LLVM is causing the issue:
AllocaInst* llvm::IRBuilder< preserveNames, T, Inserter >::CreateAlloca(Type * Ty, Value * ArraySize = 0,const Twine & Name = "")
It creates this error when I do a nonspecific allocation in this manner. The reason I use this command is that sometimes in a kernel there will be a store value that is a Constant. Since LLVM often requires a Value I needed a way of converting it. So I do a an allocation with an immediate store and load. This was suggested by another SOF user. Does anyone know an alternate method of converting a Constant to a Value in LLVM?
Thanks all.
Ok it seems a conventional:
Value *new_val = dyn_cast<Value>(old_val);
Works perfectly fine. Hopefully this knowledge will help someone else.
UPDATE3: Scratch that. Dynamic cast doesn't convert Constant to a Value type. So if anyone knows how to do that, please let me know.

I admit I don't understand the assertion error you get. However:
The reason I use this command is that sometimes in a kernel there will be a store value that is a Constant. Since LLVM often requires a Value I needed a way of converting it. So I do a an allocation with an immediate store and load.
That doesn't make sense to me:
Any llvm::Constant is already an llvm::Value
Storing a value and then loading it back seems like an expensive nop...

Related

Raw opcode from xed decoded data structures?

I am new to Intel Pintools, and am trying to write a pintool that stops at a given instruction type and then looks for specific instructions following it in the section. I've got the xed decoding working, but I am stuck at the part where I get the actual hex opcode. How can I do that?
I would love to use INS_Opcode() -- but these are instructions that haven't been executed yet (and may never be), so they aren't INS objects. There's xed_operand_values_get_iclass(), but that returns an iclass enum, not the actual primary opcode. I see from the xed header files that there are some raw buffers associated with the various xed structures, but it is not at all clear to me how I can use that to get the information I need. Can anyone enlighten me?
Apparently I missed it the first time I looked at the header files, but there's xed3_operand_get_nominal_opcode(), which does exactly what I need it to. Related: grep is a wonderful thing.

How to look ahead into a file?

I'm asking myself and you how to look ahead into a file without reading it. At a first glance the seek function seems to be appropriate. The documentation says:
seek with where = NA returns the current byte offset of a connection
(from the beginning), and with a non-missing where argument the
connection is re-positioned (if possible) to the specified position.
But at the end of that page I found the following warning:
Use of seek on Windows is discouraged. We have found so many errors in
the Windows implementation of file positioning that users are advised
to use it only at their own risk, and asked not to waste the R
developers' time with bug reports on Windows' deficiencies.
So is there any save way to look ahead?

Program exit code -SomeNumber

i made a program using Qt for Symbian, its all working very well ... However, it always exits with a status code -10737something when i close the program
i think the problem is in the deconstructer, maybe some memory leaks ... any suggestion on how to solve this problem, or to find the error using Qt Creator?
thanks
Record the exact number, convert it to hexadecimal, then put the result into a search engine and see what you can find.
The exit code you've got is most likely an error code which would normally be represented in hexadecimal (but the operating system has chosen to report program exit codes in signed decimal format).
Symbian defines a lot of globally used error codes. The most complete error code reference I know of can be found on newlc.com page.
If you post the question on SO, please be as precise as possible, don't write "I got -128903something error, please help", because the answer to the question phrased this way is "You've got an error somewhere in your code".
So if you need more help, post the error code with all details.

Segmentation fault in QHash

I got the following crash in QHash. I am unable to find any thing into. I am using Qtopia-Core-4.3.3 on Linux Machine.
The log is as follows:
ASSERT: "*node == e || (*node)->next" in file
/usr/local/Trolltech/QtopiaCore-4.3.3-400wrl/include/QtCore/qhash.h,
line 824
Segmentation fault
Can anybody help me in this?
Just a wild guess, but based on the fact that QHash is a container, and it is referring to "node", I think the given assertion is caused by the program expecting that the node is either the end node (e), or has a next node. So it appears something you are doing is messing up the entries in the hash.
To continue to speculate wildly, I have often seen some hard-to-diagnose errors when someone was iterating over a container, and sometimes removing things from the container while iterating. I don't know if QHash handles this nicely or not.

Why does this code only work when I use a break point?

See code below, for some reason it only works when I put a breakpoint on line 2 (*) is there some delay? Is it starting the next line before it finishes the 2nd one?
dp.SSLCertStoreType = nsoftware.IBizPayPal.DirectpaymentSSLCertStoreTypes.sstPEMKey
*dp.SSLCertStore = My.Computer.FileSystem.ReadAllText(Server.MapPath("\cert_key_pem.txt"))
dp.SSLCertSubject = "*"
Note: The error is thrown on the 3rd line only when the breakpoint is set on the 2nd line, after releasing the break the program executes my paypal purchase via credit card.
I will post the error again I am replicating it now...
System error: Could not acquire security credentials: error 8009030E.
There it is, while it should say "Order Confirmed!" type message if working correctly.
Almost certainly a threading issue, but nobody is going to be able to answer definitively unless they're familiar with nsoftware.IBizPayPal
Sometimes you can find that breaking can mutate an object's state, due to the locals window evaluating object properties. If they have a side-effect, then all bets are off, unfortunately :( No idea whether this is happening in your case.
I have no knowledge of ASP, so just wondering aloud: Could this be due to multithreading? You know when you put a break point you sort of freeze execution of all threads, but not so in the real execution.

Resources